aboutsummaryrefslogtreecommitdiff
path: root/addons/metadata.generic.albums/default.py
blob: b6876e3bc30275f3fa5ade21f021893d2a85e2da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
import sys
from urllib.parse import parse_qsl
from lib.scraper import Scraper


class Main:
    def __init__(self):
        action, key, artist, album, url, nfo, settings = self._parse_argv()
        Scraper(action, key, artist, album, url, nfo, settings)

    def _parse_argv(self):
        params = dict(parse_qsl(sys.argv[2].lstrip('?')))
        # actions: find, resolveid, NfoUrl, getdetails
        action = params['action']
        # key: musicbrainz id
        key = params.get('key', '')
        # artist: artistname
        artist = params.get('artist', '')
        # album: albumtitle
        album = params.get('title', '')
        # url: provided by the scraper on previous run
        url = params.get('url', '')
        # nfo: musicbrainz url from .nfo file
        nfo = params.get('nfo', '')
        # path specific settings
        settings = params.get('pathSettings', {})
        return action, key, artist, album, url, nfo, settings


if (__name__ == '__main__'):
    Main()