Commit Graph

5948 Commits

Author SHA1 Message Date
Philipp Wolfer
8608bf16e8 Merge pull request #1123 from zas/const.sys
Introduce picard.const.sys: IS_WIN, IS_MACOS, IS_LINUX, IS_FROZEN
2019-03-06 14:10:11 +01:00
Laurent Monin
1a9a86ff99 Move frozen stuff to picard.const.sys as IS_FROZEN and FROZEN_TEMP_PATH 2019-03-05 21:53:38 +01:00
Laurent Monin
6388ef20f5 Use IS_WIN, IS_MACOS, IS_LINUX 2019-03-05 21:53:32 +01:00
Laurent Monin
1f6adb07c2 Add constants IS_WIN, IS_MACOS, IS_LINUX to new picard.const.sys 2019-03-05 21:52:25 +01:00
Philipp Wolfer
6cc6e4d84e PICARD-1483: Fix submitting AcoustId for non-album tracks 2019-03-05 17:45:29 +01:00
Laurent Monin
9a7b32316d Merge pull request #1121 from zas/test_filesystem_cleanup
Test filesystem cleanup
2019-03-05 12:51:44 +01:00
Laurent Monin
9df54c1610 Introduce _assertFile()/_assertNoFile() and reduce redundancy a bit more 2019-03-05 11:03:23 +01:00
Laurent Monin
549800aa0a Simplify even more 2019-03-05 10:54:42 +01:00
Laurent Monin
48206692de Reduce code redundancy, introducing _move_additional_files(files) 2019-03-05 10:23:51 +01:00
Laurent Monin
5fa087dde3 Use a dict to store filepaths 2019-03-05 10:17:58 +01:00
Laurent Monin
6d78ff9ca3 Merge pull request #1115 from zas/file_cleanup
File cleanup
2019-03-04 22:53:01 +01:00
Philipp Wolfer
17464ab8dd Bump API version to 2.2 2019-03-04 21:52:59 +01:00
Philipp Wolfer
fb08346030 PICARD-1400: Remove Amazon cover art provider
Will be provided as plugin
2019-03-04 21:52:59 +01:00
Laurent Monin
031172f0af Test against File.LOOKUP_METADATA, more explicit, only 2 values possible 2019-03-04 21:51:29 +01:00
Laurent Monin
3582462b97 Introduce File.LOOKUP_ACOUSTID and File.LOOKUP_METADATA 2019-03-04 21:51:29 +01:00
Laurent Monin
ee6a16185d Remove useless tests 2019-03-04 21:49:31 +01:00
Laurent Monin
5bb460dac5 Use heap instead of list+sort, as we only care best result 2019-03-04 21:49:31 +01:00
Laurent Monin
de3dbbbeb4 Rework File._move_additional_files()
- use faster os.scandir() (since python 3.5)
- change the logic so we don't build list of all files but only list of files to move
- handle OSError, a file or directory could be removed during the process, or have permissions changed
- log such errors
2019-03-04 21:48:07 +01:00
Laurent Monin
bd7b471416 Test File.move_additional_files() for hidden files cases
In case patterns start with a dot we don't ignore hidden files
It was implemented in https://github.com/metabrainz/picard/pull/519
2019-03-04 21:48:07 +01:00
Laurent Monin
8d5efd4c09 Cache self.cluster_dict.get_token(y).lower() calculation 2019-03-04 21:46:17 +01:00
Laurent Monin
fbd5491376 ClusterDict.add(): tokenize only if needed 2019-03-04 21:46:17 +01:00
Laurent Monin
dc035f951f Lower word once 2019-03-04 21:46:17 +01:00
Laurent Monin
b86a687e15 Use defaultdict for words and ids properties and simplify code 2019-03-04 21:46:17 +01:00
Laurent Monin
702c4b7ca3 Remove unused print/debug method printCluster() 2019-03-04 21:46:17 +01:00
Laurent Monin
197f1e1b24 Use super() instead of parent class name 2019-03-04 21:46:17 +01:00
Laurent Monin
1f14c19a35 getSize -> get_size 2019-03-04 21:46:17 +01:00
Laurent Monin
0f54eab991 getWord -> get_word 2019-03-04 21:46:17 +01:00
Laurent Monin
771a2339a3 getToken -> get_token 2019-03-04 21:46:17 +01:00
Laurent Monin
841c8acbfc getWordAndCount -> get_word_and_count 2019-03-04 21:46:17 +01:00
Laurent Monin
9a5dcd83dd getClusterTitle -> get_cluster_title 2019-03-04 21:46:17 +01:00
Laurent Monin
e97cdaef00 getClusterFromId -> get_cluster_from_id 2019-03-04 21:46:17 +01:00
Laurent Monin
9980b7c5ff idClusterIndex -> index_id_cluster 2019-03-04 21:46:17 +01:00
Laurent Monin
5bb5f49935 clusterBins -> cluster_bins 2019-03-04 21:46:17 +01:00
Laurent Monin
00299aeb9e clusterCount -> cluster_count 2019-03-04 21:46:17 +01:00
Laurent Monin
d44a9b56dc clusterDict -> cluster_dict 2019-03-04 21:46:17 +01:00
Laurent Monin
ad12f57a55 Cleanup 2019-03-04 21:46:17 +01:00
Laurent Monin
836eea6f97 Make Album._match_files() a generator 2019-03-04 21:45:50 +01:00
Laurent Monin
372981f535 Move tracks cache building to its own method, code is easier to read 2019-03-04 21:45:50 +01:00
Laurent Monin
3fe73bc3ea Simplify code even more 2019-03-04 21:45:50 +01:00
Laurent Monin
799181dcb5 Rework Album.match_files()
- use simple comparaison and last best match instead of list + sort
- drop unused use_recordingid parameter
- split the method in two, it should ease testing
- drop match_file, and use modified match_files, reducing code redundancy
2019-03-04 21:45:50 +01:00
Laurent Monin
79eedc20e6 Add debug output for each case 2019-03-04 21:03:56 +01:00
Laurent Monin
f960dd8115 Simplify code using a bunch of return
Those if/elif were hard to read and lead to code duplication
2019-03-04 21:03:56 +01:00
Laurent Monin
498af86aa4 Make the code slightly easier to read 2019-03-04 21:03:56 +01:00
Laurent Monin
6e412f0835 No need of recordingid if option ignore_file_mbids is set 2019-03-04 21:03:56 +01:00
Laurent Monin
7538bb4a96 No need of recordingid if target is set 2019-03-04 21:03:56 +01:00
Laurent Monin
8a36cd5139 Drop useless code
This shouldn't be needed since b36d88ad46
2019-03-04 21:03:56 +01:00
Laurent Monin
8bc9cf9886 Reduce indentation level 2019-03-04 21:03:56 +01:00
Laurent Monin
beb6d94f95 Fix mbid_validate()
- drop dependency on string.Template, the regex is very simple
- test against None, as per documentation
- fix the match when the string is starting with a valid mbid but is too long
- use case-insensitive matching flag
2019-03-04 19:35:05 +01:00
Laurent Monin
1ca043dd90 Add tests for mbid_validate() 2019-03-04 19:35:05 +01:00
Laurent Monin
c948e01400 tagger.analyze(): immediatly return if acoustid is disabled
- code was setting files as pending before testing if acoustid was enabled
- test can be done before anything since that's a required condition
2019-03-04 18:26:51 +01:00