Skip to content
blog.fossasia.org
  • Home
  • Projects
    • Contribute
  • Events
    • Eventyay Platform
    • Event Sponsorships
    • Event Calendar
    • FOSSASIA Summit
    • OpenTechSummit China
    • OpenTechSummit Thailand
    • OpenTechSummit Vietnam
    • Jugaad Fest India
    • Past Events
      • FOSSASIA Summit 2022
      • FOSSASIA Summit 2021
      • FOSSASIA Summit 2020
      • FOSSASIA Summit 2019
      • FOSSASIA Summit 2018
      • FOSSASIA Summit 2017
      • FOSSASIA Summit 2016
      • FOSSASIA Summit 2015
      • FOSSASIA Summit 2014
      • FOSSASIA Summit 2012
      • FOSSASIA Summit 2011
      • FOSSASIA Summit 2010
      • GNOME.Asia 2009
      • MiniDebConf Vietnam 2010
      • Sciencehack.Asia
      • Science Hack India
  • Programs
    • Programs and Opportunities
    • Jobs Opportunities
    • Program Guidelines
    • Codeheat Contest
    • University Internship Program
    • University Student Coding Programs
    • High School Student Program
    • Advanced Developer Program
    • Become a Mentor
      • Become A University Student Mentor
      • Become A High School Student Mentor
  • Shop
  • Blog
  • About
    • Jobs
    • Membership
    • Activities
    • Background & Mission
    • Best Practices
    • Licenses
    • Team
    • Code of Conduct
  • Donate
  • Toggle website search
Menu Close
  • Home
  • Projects
    • Contribute
  • Events
    • Eventyay Platform
    • Event Sponsorships
    • Event Calendar
    • FOSSASIA Summit
    • OpenTechSummit China
    • OpenTechSummit Thailand
    • OpenTechSummit Vietnam
    • Jugaad Fest India
    • Past Events
      • FOSSASIA Summit 2022
      • FOSSASIA Summit 2021
      • FOSSASIA Summit 2020
      • FOSSASIA Summit 2019
      • FOSSASIA Summit 2018
      • FOSSASIA Summit 2017
      • FOSSASIA Summit 2016
      • FOSSASIA Summit 2015
      • FOSSASIA Summit 2014
      • FOSSASIA Summit 2012
      • FOSSASIA Summit 2011
      • FOSSASIA Summit 2010
      • GNOME.Asia 2009
      • MiniDebConf Vietnam 2010
      • Sciencehack.Asia
      • Science Hack India
  • Programs
    • Programs and Opportunities
    • Jobs Opportunities
    • Program Guidelines
    • Codeheat Contest
    • University Internship Program
    • University Student Coding Programs
    • High School Student Program
    • Advanced Developer Program
    • Become a Mentor
      • Become A University Student Mentor
      • Become A High School Student Mentor
  • Shop
  • Blog
  • About
    • Jobs
    • Membership
    • Activities
    • Background & Mission
    • Best Practices
    • Licenses
    • Team
    • Code of Conduct
  • Donate
  • Toggle website search

MetaData

Read more about the article Using Fastlane to Release the Badge Magic Android App on Playstore and F-droid

Using Fastlane to Release the Badge Magic Android App on Playstore and F-droid

  • Post author:adityastic
  • Post published:October 30, 2019
  • Post category:FOSSASIA
  • Post comments:0 Comments


fastlane is the easiest way to automate beta deployments and releases for Android apps. We are going to see how we used fastlane in fossasia/badge-magic-android to automate almost everything inside our project.


Fastlane Configuration

In Badge Magic, fastlane is integrated to deploy apps on Playstore as well as F Droid. This is a very straightforward method to manage both things from a single perspective.

This is the hierarchy of the fastlane folder and it specifies the following:

  • Metadata:

This folder holds the information regarding the project and every other resource such as images, changelogs, descriptions.

Every time we publish anything using the fastlane command, it checks the files and uploads the changes on every build.

  • AppFile:
json_key_file("./scripts/fastlane.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("org.fossasia.badgemagic") # e.g. com.krausefx.app

AppFile is responsible for specifying the path of the google json and the package name of the project.

  • Fastfile: 

This is by far the most important file which handles almost everything with respect to scripting. Let’s have a look in more detail.


Fastfile

Fastfile contains all the code required to run lanes and define the tasks that need to be performed.

In this file, we first define the platform we are going to work on. In our case it is android, therefore: 

default_platform(:android)

Let’s create a lane which builds the aab package for our deployment. We can specify the gradle task with the type which needs to be performed when we run a specific lane.

lane :buildAAB do
    gradle(task: "bundle",build_type: "Release")
end

Let’s create another lane which uploads the aab package from our build directly to the play store server. 

lane :uploadToPlaystore do
    upload_to_play_store(track:"alpha",aab:"apk/badge-magic-master-app.aab")
end

This uploads the aab present in the specified directory to the playstore. So finally our final Fastfile looks like this:

default_platform(:android)
platform :android do
    lane :buildAAB do
        gradle(task: "bundle",build_type: "Release")
    end
    lane :uploadToPlaystore do
        upload_to_play_store(track: "alpha",aab:"apk/badge-magic-master-app.aab")
    end
end

Conclusion

Fastlane is amazing and it automates almost everything for you. Fastfile is written in ruby and you can code lane dependencies, condition builds and anything you can think of when it comes to build automation.

Using fastlane we integrated 2 app stores without any hassle or code duplication.

Ressources

  • Fastlane docs, fastlane team, https://docs.fastlane.tools/
  • Fastlane for Android, March 15th 2019, Chan Lo, https://medium.com/open-knowledge/fastlane-for-android-automate-everything-part-i-ad42bbb15365
  • Fastlane + CircleCI, March 18th 2019, Chan Bo, https://medium.com/open-knowledge/fastlane-circleci-for-android-part-1-471e29b968b2
Continue ReadingUsing Fastlane to Release the Badge Magic Android App on Playstore and F-droid
Read more about the article Fetching Metadata in Loklak Server

Fetching Metadata in Loklak Server

  • Post author:Vibhor Verma
  • Post published:September 1, 2017
  • Post category:FOSSASIA/loklak
  • Post comments:0 Comments

In Loklak Server multiscrapers are working fine but there was a need to setup metadata framework to be embedded with the data. Metadata outputs the parameters passed, number of hits on the webpage to fetch results and number of results outputted.

There is no metadata framework for TwitterScraper. Metadata is collected but there are 2 issues:

1) the metadata fields are directly feeded while outputing data.

2) Every Scraper had different metadata fields or none.

To improve this for multiscraper system, I embedded metadata by configuring in the BaseScraper class and in PostTimeline iterator. If the metadata is directly collected in BaseScraper itself, then it will become non-of-developer-concern while working on scrapers and he can concentrate on improving scrapers.

These are the following changes I made in code:

1) Input Get-Parameters

For scrapers, one of the metadata field was input parameters. I directly added them in metadata block.

protected Post getMetadata() {
    Post metadata = new Post(true);
    metadata.put("hits", this.hits);
    metadata.put("count", this.count);
    metadata.put("scraper", this.scraperName);
    metadata.put("input_parameters", this.extra);
    return metadata;
}

 

2) Hits and Counts

Hits refer to number of times Loklak Server made a hit to the target website where as Counts refer to number of posts scraped by the scraper. To fetching these data was easy.

For count, I added a method putData in BaseScraper. It shall be used to create list of posts instead of directly creating the list. Here I have added counter which counts the posts.

protected Post putData(Post typeArray, String key, JSONArray postList) {
    this.count = this.count + postList.length();
    typeArray.put(key, postList);
    return typeArray;
}

 

For hits, I just counted the number of times the URL was fed into ClientConnection method.

public Post getDataFromConnection(String url, String type) throws IOException {
// This adds to hits count even if connection fails
    this.hits++;
    ClientConnection connection = new ClientConnection(url);
.
.
.

 

3) For multiscrapers in Search Endpoint

This was a bit tricky task. For creating metadata block for all the scrapers, I had to fetch metadata block of all the scrapers, process them and then output with the results. I added this to PostTimeline iterator and implemented in a loop when a scraper outputs data.

public void collectMetadata(JSONObject metadata) {
    // INITIALIZE PARAMETERS
    int hits = 0;
    int count = 0;
    Set scrapers = new HashSet<String>();

    // GET LIST OF KEYS IN SCRAPER
    List<String> listKeys = new ArrayList<String>(this.posts.keySet());
    int n = listKeys.size();

    for (int i = 0; i < n; i++) {
        // FETCH METADATA POST FROM SCRAPED DATA
        Post postMetadata = (Post) this.posts.get(listKeys.get(i)).get("metadata");
        hits = hits + Integer.parseInt(String.valueOf(postMetadata.get("hits")));
        count = count + Integer.parseInt(String.valueOf(postMetadata.get("count")));
        scrapers.add(postMetadata.get("scraper"));
    }

    // SET OUTPUT
    metadata.put("hits", hits);
    metadata.put("count", count);
    metadata.put("scraper_count", scrapers.size());
    metadata.put("scrapers", scrapers);
}

 

References

  • Crawlers and Metadata Extraction (Stuff that needs to be solved): https://vimeo.com/53109189
  • Why Metadata? https://www.villanovau.com/resources/bi/metadata-importance-in-data-driven-world/#.WZmbMKvhXeQ
Continue ReadingFetching Metadata in Loklak Server
  • FOSSASIA
  • Blog
  • GitHub
  • Projects
  • Code of Conduct
  • About
  • Contact
Copyright - WordPress Theme by OceanWP