Imported Upstream version 2.0.1
Sebastian Ramacher
8 years ago
21 | 21 | Ulrich Klauer |
22 | 22 | Jim Patterson |
23 | 23 | - minor fixes |
24 | ||
25 | Ville Skyttä | |
26 | - mocking fix for the tests |
0 | ### Changes in 2.0.1 (2015-06-06) | |
1 | * [#94] also install isrcsubmit-config.5 | |
2 | * [#93] fix name 'FileNotFoundError' is not defined | |
3 | * [#96] fix display of "missing backend" error | |
4 | * [#98] be case insensitive for Y/N prompts | |
5 | ||
0 | 6 | ### Changes in 2.0.0 (2014-05-05) |
1 | 7 | * [#59] use libdiscid as isrc backend |
2 | 8 | * [#6] use the NGS (WS/2) web service |
0 | Isrcsubmit 2.0.0 for MusicBrainz | |
1 | ==================================== | |
0 | Isrcsubmit 2.0.1 for MusicBrainz | |
1 | ================================ | |
2 | 2 | |
3 | 3 | This python script extracts ISRCs_ from audio CDs |
4 | 4 | and submits them to MusicBrainz_. |
125 | 125 | The core of the MusicBrainz dataset including the ISRC contributions is placed |
126 | 126 | into the Public Domain. |
127 | 127 | |
128 | For a documentation of the available backends please refer to the manual | |
129 | or the `web page`_. | |
130 | ||
128 | 131 | You might find additional information about this script at the |
129 | 132 | `MusicBrainz forums`_. |
130 | 133 | |
134 | .. _web page: http://jonnyjd.github.io/musicbrainz-isrcsubmit/backends | |
131 | 135 | .. _MusicBrainz forums: http://forums.musicbrainz.org/viewtopic.php?id=3444 |
132 | 136 | |
133 | 137 |
43 | 43 | |
44 | 44 | # General information about the project. |
45 | 45 | project = u'isrcsubmit' |
46 | copyright = u'2010-2013, Johannes Dewender' | |
46 | copyright = u'2009-2015, Johannes Dewender' | |
47 | 47 | |
48 | 48 | # The version info for the project you're documenting, acts as replacement for |
49 | 49 | # |version| and |release|, also used in various other places throughout the |
11 | 11 | ----------- |
12 | 12 | |
13 | 13 | The configuration file contains various options controlling the behavior of |
14 | :program:`isrcsubmit`. All the options given here can be overriden by passing | |
14 | :program:`isrcsubmit`. All the options given here can be overridden by passing | |
15 | 15 | command line arguments to :program:`isrcsubmit`. |
16 | 16 | |
17 | 17 | If **$XDG_CONFIG_HOME** is not set, **%APPDATA%** is used on Windows |
33 | 33 | -b <program>, --backend=<program> |
34 | 34 | Force using a specific backend to extract ISRCs from the disc. Possible |
35 | 35 | backends are: mediatools, media_info, cdrdao, libdiscid, discisrc. They are |
36 | tried in this order otherwise. | |
36 | tried in this order otherwise. See also :strong:`BACKENDS`. | |
37 | 37 | --browser=<browser> |
38 | 38 | Program to open URLs. This will be automatically deteced for most setups, |
39 | 39 | if not chosen manually. |
46 | 46 | --no-keyring |
47 | 47 | Do not use keyring. |
48 | 48 | |
49 | Backends | |
50 | -------- | |
51 | ||
52 | :program:`isrcsubmit` is able to use various backends to extract the ISRC. | |
53 | The **libdiscid** library is a requirement for isrcsubmit | |
54 | and can also be used as a backend on most systems. | |
55 | ||
56 | ISRCs are nearly always stored in the subchannel information | |
57 | and all tools read them from there. | |
58 | However, some drives tend to extract the same ISRC for adjacent tracks. | |
59 | Restarting the script might help and using a different drive might help. | |
60 | CD writers are reported to give better results than many CD reader drives. | |
61 | ||
62 | mediatools, media_info | |
63 | These tools use an experimental algorithm to gather ISRCs from the disc. | |
64 | This should give less duplicates on the same drive than with other tools. | |
65 | However, there might be other problems. (only available for Windows) | |
66 | ||
67 | cdrdao | |
68 | This tool can read ISRCs from CD-Text if no ISRCs are in the subchannel | |
69 | information. | |
70 | This is rarely the case. Most ISRCs are stored in the subchannel. | |
71 | (usually available on Linux, but there are also Windows builds (plank)) | |
72 | ||
73 | libdiscid | |
74 | Starting with **libdiscid** 0.3.0 this can be used not only for | |
75 | the disc ID, but also to extract ISRCs. | |
76 | (Windows, Mac; Linux support with 0.3.1) | |
77 | ||
78 | discisrc | |
79 | The **discisrc** binary is created from source builds of **libdiscid**. | |
80 | There is an experimental branch *isrc_raw* that might give | |
81 | better results regarding duplicate ISRCs on Linux. | |
82 | You can use this binary separately without installing | |
83 | an experimental libdiscid library on the system. | |
84 | ||
85 | ||
49 | 86 | See also |
50 | 87 | -------- |
51 | 88 | |
54 | 91 | Author |
55 | 92 | ------ |
56 | 93 | |
57 | This manual page was written by Sebastian Ramacher. :program:`isrcsubmit` was | |
58 | written by Johannes Dewender. | |
94 | This manual was written by Sebastian Ramacher and Johannes Dewender. | |
95 | :program:`isrcsubmit` was written by Johannes Dewender. |
0 | 0 | #!/usr/bin/env python |
1 | # Copyright (C) 2010-2013 Johannes Dewender | |
1 | # Copyright (C) 2009-2015 Johannes Dewender | |
2 | 2 | # |
3 | 3 | # This program is free software: you can redistribute it and/or modify |
4 | 4 | # it under the terms of the GNU General Public License as published by |
20 | 20 | https://github.com/JonnyJD/musicbrainz-isrcsubmit |
21 | 21 | """ |
22 | 22 | |
23 | __version__ = "2.0.0" | |
23 | __version__ = "2.0.1" | |
24 | 24 | AGENT_NAME = "isrcsubmit.py" |
25 | 25 | DEFAULT_SERVER = "musicbrainz.org" |
26 | 26 | # starting with highest priority |
368 | 368 | if backend is None: |
369 | 369 | print_error("Cannot find a backend to extract the ISRCS!", |
370 | 370 | "Isrcsubmit can work with one of the following:", |
371 | " " + ", ".join(backend)) | |
371 | " " + ", ".join(BACKENDS)) | |
372 | 372 | sys.exit(-1) |
373 | 373 | |
374 | 374 | return backend |
409 | 409 | else: |
410 | 410 | with open(os.devnull, "w") as devnull: |
411 | 411 | Popen([options.browser, url], stdout=devnull) |
412 | except FileNotFoundError as err: | |
412 | except OSError as err: | |
413 | 413 | error = ["Couldn't open the url in %s: %s" |
414 | 414 | % (options.browser, str(err))] |
415 | 415 | if submit: |
548 | 548 | submit_requested = True |
549 | 549 | else: |
550 | 550 | printf("Would you like to open the browser to submit the disc?") |
551 | submit_requested = user_input(" [y/N] ") == "y" | |
551 | submit_requested = user_input(" [y/N] ").lower() == "y" | |
552 | 552 | |
553 | 553 | if submit_requested: |
554 | 554 | open_browser(url, exit=True, submit=True) |
996 | 996 | if duplicates > 0: |
997 | 997 | printf("\nThere were %d ISRCs ", duplicates) |
998 | 998 | print("that are attached to multiple tracks on this release.") |
999 | if user_input("Do you want to help clean those up? [y/N] ") == "y": | |
999 | choice = user_input("Do you want to help clean those up? [y/N] ") | |
1000 | if choice.lower() == "y": | |
1000 | 1001 | cleanup_isrcs(release, isrcs) |
1001 | 1002 | |
1002 | 1003 | def cleanup_isrcs(release, isrcs): |
1036 | 1037 | print("") |
1037 | 1038 | |
1038 | 1039 | url = "http://%s/isrc/%s" % (options.server, isrc) |
1039 | if user_input("Open ISRC in the browser? [Y/n] ") != "n": | |
1040 | if user_input("Open ISRC in the browser? [Y/n] ").lower() != "n": | |
1040 | 1041 | open_browser(url) |
1041 | 1042 | user_input("(press <return> when done with this ISRC) ") |
1042 | 1043 | |
1059 | 1060 | stream_handler.setLevel(logging.INFO) |
1060 | 1061 | |
1061 | 1062 | # adding log file |
1062 | file_handler = logging.FileHandler("isrcsubmit.log", mode='w', | |
1063 | logfile = "isrcsubmit.log" | |
1064 | file_handler = logging.FileHandler(logfile, mode='w', | |
1063 | 1065 | encoding="utf8", delay=True) |
1064 | 1066 | formatter = logging.Formatter("%(levelname)s:%(name)s: %(message)s") |
1065 | 1067 | file_handler.setFormatter(formatter) |
1066 | 1068 | file_handler.setLevel(logging.DEBUG) |
1069 | logger.info("Writing debug log to %s" % logfile) | |
1067 | 1070 | logging.getLogger().addHandler(file_handler) |
1068 | 1071 | |
1069 | 1072 | # add context to log file (DEBUG only added there) |
1106 | 1109 | else: |
1107 | 1110 | if errors > 0: |
1108 | 1111 | print_error("%d problems detected" % errors) |
1109 | if user_input("Do you want to submit? [y/N] ") == "y": | |
1112 | if user_input("Do you want to submit? [y/N] ").lower() == "y": | |
1110 | 1113 | ws2.submit_isrcs(tracks2isrcs) |
1111 | 1114 | else: |
1112 | 1115 | update_intention = False |
0 | version := 2.0.0 | |
0 | version := 2.0.1 | |
1 | 1 | current := isrcsubmit-$(version) |
2 | 2 | |
3 | 3 | downloads := ../web/isrcsubmit.jonnyjd.net/downloads/ |
17 | 17 | source_branch := master |
18 | 18 | source_dir := isrcsubmit |
19 | 19 | |
20 | # TODO: make sure isrcsubmit.py is really updated! | |
20 | 21 | |
21 | 22 | tag_ref := $(source_repo)/.git/refs/tags/v$(version) |
22 | 23 | branch_ref := $(source_repo)/.git/refs/heads/$(source_branch) |
137 | 138 | rm -rf $(base_libs) |
138 | 139 | rm -rf mediatools mediatools.exe |
139 | 140 | |
140 | .PHONY: source_update | |
141 | .PHONY: $(source_ref) |
41 | 41 | import os.path |
42 | 42 | man_pages = [ |
43 | 43 | (os.path.join(man_dir, 'man1'), ['build/man/isrcsubmit.1']), |
44 | (os.path.join(man_dir, 'man5'), ['build/man/isrcsubmit-config.5']) | |
44 | 45 | ] |
45 | 46 | else: |
46 | 47 | man_pages = [] |
90 | 91 | |
91 | 92 | cmdclass["test"] = Test |
92 | 93 | |
94 | with open("README.rst") as readme: | |
95 | long_description = readme.read() | |
93 | 96 | |
94 | 97 | setup(name="isrcsubmit", |
95 | 98 | version=__version__, |
96 | 99 | description="submit ISRCs from disc to MusicBrainz", |
97 | long_description=open("README.rst").read(), | |
100 | long_description=long_description, | |
98 | 101 | author="Johannes Dewender", |
99 | 102 | author_email="brainz@JonnyJD.net", |
100 | 103 | url="https://github.com/JonnyJD/musicbrainz-isrcsubmit", |
0 | 0 | #!/usr/bin/env python |
1 | # Copyright (C) 2013 Johannes Dewender | |
1 | # Copyright (C) 2014 Johannes Dewender | |
2 | 2 | # This test is free. You can redistribute and/or modify it at will. |
3 | 3 | |
4 | 4 | import os |
152 | 152 | with open(file_name, "rb") as disc_file: |
153 | 153 | return pickle.load(disc_file) |
154 | 154 | |
155 | discid.read = _read | |
155 | isrcsubmit.discid.read = _read | |
156 | 156 | |
157 | 157 | |
158 | 158 | # mock cdrdao reading |