source: devtools/generate_AppImage_catalogue/dl_appImageCat.py @ 5166

Last change on this file since 5166 was 5166, checked in by Juanma, 21 months ago

added appImage catalogue generator

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/usr/bin/env python3
2#Download and generate a yml catalog from appimage repository at https://dl.bintray.com/probono/AppImages/
3
4import urllib.request
5
6def fetch_repo(repo):
7        with urllib.request.urlopen('https://dl.bintray.com/probono/AppImages') as f:
8                content=(f.read().decode('utf-8'))
9        return(content)
10
11def generate_applist(content):
12        garbageList=[]
13        garbageList=content.split(' ')
14        for garbageLine in garbageList:
15                if garbageLine.endswith('AppImage"'):
16                        app=garbageLine.replace('href=":','')
17                        applist.append(app.replace('"',''))
18        return(applist)
19
20def write_yml(applist,outfile):
21        f=open(outfile,'w')
22        for app in applist:
23                f.write("---\n")
24                f.write("Categories:\n  - GTK\n  - AppImage\n")
25                f.write("ID: "+app+"\n")
26                f.write("Icon:\n  stock: appImage.png\n")
27                name=app.split('.')[0]
28                f.write("Name:\n C: "+name+"\n")
29                f.write("Package: "+name+".AppImage\n")
30                f.write("Summary:\n  C: "+name+" AppImage Bundle\n")
31                f.write("Description:\n")
32                f.write("  C: This is an AppImage bundle of app "+name+". It hasn't been tested by our developers and comes from a 3rd party dev team. Please use it carefully\n")
33                f.write("  es: Este es el paquete AppImage de la aplicación "+name+". No ha sido testado por nuestros desarrolladores y proviene de equipo de desarrollo externo. Por favor, utilizalo con cuidado\n")
34                f.write("  ca_ES@valencia: This is an AppImage bundle of app "+name+". It hasn't been tested by our developers and comes from a 3rd party dev team. Please use it carefully\n")
35                f.write("Type: desktop-app\n")
36                f.write("Bundle:\n- type: appimage\n  id: "+app+"\n")
37        f.close()
38
39outfile='appimage.yml'
40content=''
41applist=[]
42repolist=['https://dl.bintray.com/probono/AppImages']
43for repo in repolist:
44        print(("Fetching repo %s")%(repo))
45        applist=generate_applist(fetch_repo(repo))
46        print("Generating dep11 catalogue...")
47        write_yml(applist,outfile)
48        print("Work done!")
49
50
Note: See TracBrowser for help on using the repository browser.