-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PICARD-1685 : Add ~filesize variable #2361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good, thanks a lot for for looking over the code with so much detail. Just some minor comments.
If you feel up to it you could also update the documentation at https://picard-docs.musicbrainz.org/en/variables/variables_file.html to have the _filesize
variable listed there. The docs are managed in https://github.com/metabrainz/picard-docs
I will soon add the rest of the requirements along with the documentations and code the formated according to the PEP 8 standards |
Added checks to other formates for '~filesize', also added '~filsize' to metadata in wav.py |
Added _filesize variable as mentioned in "metabrainz/picard#2361"
Also raised PR "metabrainz/picard-docs#218" for updating the _filesize variable as mentioned by @phw :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good. LGTM
Not fully sure why https://github.com/metabrainz/picard/actions/runs/7540649415/job/20539127340?pr=2361 is failing. I first assumed it was because of mutagen==1.3.7, but testing with this mutagen version locally shows no errors. One cause might be that the randomization of tests (with pytest-randomly) makes this issue happen only sometimes. Does some other test maybe write to the source file? |
Head branch was pushed to by a user without write access
Yes, I have confirmed this. When I tested with |
Now it fails in other cases :( Something is going on here, but I don't yet understand what. mutagen 1.37 is an old version without WAVE support, so we are in the alternative code paths picard/test/formats/test_wav.py Line 148 in 94250ff
Line 226 in 94250ff
I don't see what the issue is right now. Maybe some Python 3.8 bug? But I'd be happy with just disabling the filesize check for WAVE for now and merge this change. @zas any ideas? |
I carefully checked the failed tests and found the following issues:
I am not sure why it's behaving like this. |
As |
We'll drop 3.8 out of the CI builds and set 3.9 as min. supported version some time shortly after it has become EOL. No big migration really as there is full compatibility with newer versions. The only thing that will be impacted is drop for Windows 7 support, but we have this with the Qt6 migration anyway. That's why the Windows builds in the master branch do build with Python 3.12 already. |
The test was saving before loading, hence having the side effect of altering file sizes.
@nullHawk I found the issue, that was tricky. The issue was that the See 0332f29#diff-7d25cea7df3c99710f9ba35f5231579dcd76cebc8effb6fb0ea01dfa531e2b57L238 I took the freedom to commit this change directly to the PR in 0332f29 |
Now only some style issues remain. Can you check this locally? We use isort to organize the import statements, see https://github.com/metabrainz/picard/blob/master/CONTRIBUTING.md |
Oh I see now...Thanks a lot! |
Sure :) |
As a first-time contributor, I forgot to set up the If you're considering making the readme more beginner-friendly, I'd be happy to submit a pull request for that. I can also list and add all the details I missed to ensure that any other first-time contributor won't overlook the same things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Add ~filesize variable
Problem
Provide the file size in bytes as a hidden file variable ~filesize (similar to the existing file variables like e.g. ~bitrate and ~length).
Solution
I have added the "~filename" variable which stores the size of the file in bytes using "os.path.getsize" and passing the "self.filename" in it. also I have used this variable in infodialog.py to show Size. Modified test cases for '~filsize'. Add '~filesize' to metadata in wav.py since it doesn't uses mutagen.
Action
I don't know if you want to also add size option in itemviews.py (since it was mention in the old discussion "https://community.metabrainz.org/t/current-file-size/453338/5"). If yes, then please specifiy how to add it in UI, sicne the size is in bytes and in itemviews.py values are directly added from the list ("columns").