Esempio n. 1
0
def main():
    command = get_command()
    if command.get('dbid') and command.get('mediatype'):
        processor = ArtworkProcessor()
        processor.process_item(command['mediatype'], int(command['dbid']), command.get('mode', 'auto'))
    elif 'command' in command:
        if command['command'] == 'set_autoaddepisodes':
            set_autoaddepisodes()
        elif command['command'] == 'clean_arturls':
            runon_allmedia(L(M.CLEAN_ART_URLS), L(M.FIXED_URL_COUNT), cleaner.clean_artwork)
        elif command['command'] == 'remove_otherartwork':
            runon_allmedia(L(M.REMOVE_EXTRA_ARTWORK), L(M.REMOVED_ART_COUNT), cleaner.remove_otherartwork)
    else:
        processor = ArtworkProcessor()
        if processor.processor_busy:
            options = [(L(M.STOP), 'NotifyAll(script.artwork.beef, CancelCurrent)')]
        else:
            options = [(L(M.ADD_MISSING_FOR_NEW), 'NotifyAll(script.artwork.beef, ProcessNewItems)'),
                (L(M.ADD_MISSING_FOR_ALL), 'NotifyAll(script.artwork.beef, ProcessAllItems)')]
        selected = xbmcgui.Dialog().select('Artwork Beef', [option[0] for option in options])
        if selected >= 0 and selected < len(options):
            pykodi.execute_builtin(options[selected][1])