Esempio n. 1
0
 def test(self):
     url = 'https://www.discogs.com/Radiohead-The-Bends/release/368116'
     args = ['-u', url, 'abc']
     parser = ArgumentParser(args)
     self.assertTrue(parser['urlvalid'])
     self.assertEqual(parser['url'], url)
     self.assertFalse(parser['ambiguous'])
Esempio n. 2
0
 def test(self):
     url = '<Invalid Url>'
     args = ['-u', url, 'abc']
     parser = ArgumentParser(args)
     self.assertFalse(parser['urlvalid'])
     self.assertEqual(parser['url'], url)
     self.assertFalse(parser['ambiguous'])
Esempio n. 3
0
def main():
    base_url = WebCrawler().base_url
    parser = ArgumentParser()
    settings = SettingsManager()

    if not settings.load():
        print("Couldn't find settings file. Creating new one...")
        settings.generate()
    else:
        print("Loading settings file...")

    if len(parser['files']) == 0:
        print("You haven't selected any files!")
        sys.exit(3)

    if parser['ambiguous']:
        print("There cannot be both interactive and URL option! Choose one.")
        sys.exit(1)

    if parser['url'] is not None:
        if not parser['urlvalid']:
            print(
                "Given URL is not a valid Discogs release URL. Example: " +
                "'https://www.discogs.com/Mr-James-Barth-AD-Knockin-Boots-Vol-2-Of-2/release/2'"
            )
            sys.exit(2)
        autosearch = AutoSearch(parser, settings)
        autosearch.search_release()
        if autosearch.ask_if_ok():
            autosearch.tag_files()
    elif parser['interactive']:
        interactive_search = InteractiveSearch(parser, settings)
        interactive_search.search_artist()
        interactive_search.choose_release()
        if interactive_search.ask_if_ok():
            interactive_search.tag_files()
Esempio n. 4
0
 def test(self):
     url = 'https://www.discogs.com/Radiohead-The-Bends/release/368116'
     args = ['-u', url, 'file1.flac', 'file2.flac']
     parser = ArgumentParser(args)
     self.assertFalse(parser['ambiguous'])
     self.assertEqual(parser['files'], ['file1.flac', 'file2.flac'])
Esempio n. 5
0
 def test(self):
     args = ['-i', 'abc']
     parser = ArgumentParser(args)
     self.assertTrue(parser['interactive'])
     self.assertFalse(parser['ambiguous'])