Philipp Wolfer
321637b6d6
Merged DataObj class with MetadataItem class
2024-06-03 08:27:13 +02:00
Philipp Wolfer
c333208788
PICARD-2850: Use old filename if naming script evaluates to empty filename
...
This is a variation of previously fixed PICARD-2219, but for the case
where only the basename results in an empty name.
2024-04-02 19:49:30 +02:00
Laurent Monin
c166041531
Move FILE_INFO_TAGS from class File to module picard.util.tags
...
It reduces the size of objects, and it doesn't seem we ever needed to change it.
2024-04-02 18:25:33 +02:00
Philipp Wolfer
112e0d885e
PICARD-2685: Preserve calculated AcoustID and ReplayGain tags
...
Preserve calculated AcoustID fingerprint and ReplayGain tags set on a file
object when that file object gets moved between tracks.
2023-07-25 00:47:31 +02:00
Philipp Wolfer
c9e728f97d
Added tests for file.copy_metadata
2023-07-25 00:47:31 +02:00
Philipp Wolfer
75871991b8
PICARD-2595: Customizable replacement for directory separators
2022-12-06 09:37:45 +01:00
Philipp Wolfer
cb339c6a4a
PICARD-356: Allow user defined replacements for Windows incompatible characters
2022-12-05 17:08:56 +01:00
Philipp Wolfer
95c736a13e
PICARD-2553: Add option to use underscores instead of spaces in file naming
...
This collapses multiple whitespace characters and underscores in a filename into a single underscore
2022-12-04 18:07:42 +01:00
Philipp Wolfer
ff6d783d36
PICARD-2549: Fixed similarity not getting updated if only difference is cover art
...
If a file is moved to a track where the metadata matches perfectly but only cover art is different, then the similarity score of this file was not recalculated. That means the file retains the similarity of the previous (probably bad) match. Also only do this change if the state was NORMAL before (similar to the other state updates, ignoring states like PENDING and ERROR).
2022-09-25 15:24:15 +02:00
Philipp Wolfer
095e8b7615
Handle flake8=5.0 code style warnings
2022-07-31 13:34:43 +02:00
Philipp Wolfer
5037ce9935
PICARD-2076: Allow ignoring the Windows filepath limit when renaming files
2022-03-08 14:00:24 +01:00
Laurent Monin
2f6479747d
Update headers
2022-02-07 09:41:57 +01:00
Laurent Monin
820551d513
Move FILE_INFO_TAGS to File class and reduce code redundancy
...
- add a test for File._copy_file_info_tags()
2022-01-04 12:00:19 +01:00
Laurent Monin
14ce07756e
Update Copyright headers, with the help of fix-headers.py script
2021-11-10 21:38:54 +01:00
Laurent Monin
5b396ea766
Move part of File.update() code to a new generator File._tags_to_update()
...
- test it separately
- override File.supports_tag() for all tests, it ensures consistency
2021-11-10 18:06:01 +01:00
Laurent Monin
ca6cee6096
Simplify tests
2021-11-10 16:03:46 +01:00
Laurent Monin
da5fabc63f
Also test with initial default state File.PENDING where it makes sense
2021-11-10 12:47:53 +01:00
Laurent Monin
9d5d0fd01e
File.update(): add tests, 100% coverage
...
pytest --verbose --cov=picard --cov-report html test/test_file.py -k "FileUpdateTest"
2021-11-10 11:38:55 +01:00
Laurent Monin
93a8d83365
Make _compile_move_additional_files_pattern() a static method and simplify tests
...
- do not pass config but the patterns string
- make it a static method (it doesn't need self anyway)
- simplify tests accordingly
2021-11-09 21:43:40 +01:00
Laurent Monin
37982bed94
Also test weird whitespacing, multiple or newlines
2021-11-09 17:42:48 +01:00
Laurent Monin
baba955cf0
Since the pattern matching is case-insensitive, lowercase pattern string
...
- it helps to remove duplicates (like cover.jpg cover.JPG)
- fix test accordingly
2021-11-09 17:27:15 +01:00
Laurent Monin
21c5722f5a
Add tests for File._compile_move_additional_files_pattern()
2021-11-09 13:18:27 +01:00
Laurent Monin
a213b5e4ea
Fix tests
2021-09-16 10:38:21 +02:00
Bob Swift
3764518d7f
Fix tests.
2021-06-13 17:45:21 -06:00
Laurent Monin
ab54651438
Update headers
2021-06-03 13:20:42 +02:00
Laurent Monin
16b6fe3473
Add tests for File._guess_tracknumber_and_title()
2021-06-03 13:00:41 +02:00
Philipp Wolfer
6d8ddca958
PICARD-2220: Add default extension to files without extension
...
Added tests for handling file extensions (missing, lowercasing, scripted).
2021-06-02 20:22:01 +02:00
Philipp Wolfer
d6cf57f548
PICARD-2219: Fix empty renaming script breaking the filename
...
A renaming script evaluating to an empty name would cause files to be renamed to e.g. "_mp3", breaking the file extension. Now the original filename will be kept.
2021-06-02 11:32:32 +02:00
Sophist
a5fcde1dd3
PICARD-2174: Optimize implementation to display format specific metadata
2021-04-30 11:43:37 +02:00
Philipp Wolfer
c0e6243a13
PICARD-1926: Adjust test cases for new config structure
2020-12-25 12:37:15 +01:00
Philipp Wolfer
fb83a8e76b
Enable flake8 E265: Block comment should start with '# '
...
Most changes involve replacing non-breaking space with a simple space after the #.
2020-05-13 11:03:13 +02:00
Laurent Monin
6b5e852a60
Run fix-header on *.py
2020-02-24 10:25:09 +01:00
Philipp Wolfer
7e350da299
Refactor File to handle acoustid_fingerprint
...
acoustid_fingerprint is now a normal attribute of File and always available. Adding and removing the file to and from the AcoustIDManager is now completely handled in File.
2020-02-20 07:29:51 +00:00
Laurent Monin
498c8eab1b
Add mktmpdir method to PicardTestCase, and use it more widely
2020-02-08 18:04:39 +01:00
Laurent Monin
b7389a6445
Tests: ensure temporary directories and files are removed after tests
...
- QSettings object needs special care, as file was re-created on exit
- Append a cleanup function as soon as possible to ensure temporary dirs & files are removed in any case
- prefer addCleanup() over tearDown(), keeping creation and cleanup together
2020-02-08 18:04:39 +01:00
Philipp Wolfer
7c6929286b
Apply utime test workaround for all macOS versions.
...
This also seems not only on the macOS version but also on the Python build being used. On the build server with macOS 10.15 this works with the Python binaries provided on the server, but fails with official binaries from python.org.
2020-02-06 19:55:42 +01:00
Philipp Wolfer
157d3cfc97
Fixed file naming tests on Windows
2019-08-07 08:47:22 +02:00
Philipp Wolfer
9d67a45bde
Added tests for File.make_filename
2019-08-05 19:32:47 +02:00
Philipp Wolfer
f4d27d1fcc
PICARD-1561: On macOS 10.14 test preserve time only with second accuracy
2019-07-23 10:08:26 +02:00
Laurent Monin
a9cf9d55c8
File._preserve_times(): fix broken logic
...
- access times are likely to differ, a race condition is possible
- stat() has be done after the change to be able to compare
- comments added
- force sync after modifying test file
- make code easier to understand
See https://github.com/metabrainz/picard/pull/1132#issuecomment-474113665
2019-03-19 23:21:59 +01:00
Laurent Monin
6a63c3e5be
Improve file times preservation using os.utime() ns parameter (py >= 3.3)
...
https://docs.python.org/3/library/os.html#os.utime
Since Python 3.3, ns parameter is available
"The best way to preserve exact times is to use the st_atime_ns and st_mtime_ns
fields from the os.stat() result object with the ns parameter to utime."
Make time preservation testable.
2019-03-14 10:57:55 +01:00
Philipp Wolfer
68d5bb3b33
PICARD-1341: Fix cluster sorting by disc and track number
2018-11-25 11:17:22 +01:00