namidaco / namida

A Beautiful and Feature-rich Music & Video Player with Youtube Support, Built in Flutter
Other
2.09k stars 127 forks source link

Editing Tags corrupts files (changes duration of songs) #129

Closed f4b4d1 closed 7 months ago

f4b4d1 commented 7 months ago

When editing a songs tags and douple tapping on save while listening to it, the duration gets shortend when starting it again after another song has played. Discovered it yesterday as I was naming some 1 hour long mixes on my phones SD-card. Sometimes I tapped a second time on "Save". When starting the song again it seems like the already listened part got cropped out and only the not listened part is left in the file. (The whole file size gets altered)

Steps to reproduce:

  1. Have a Backup of Song A
  2. Start a (long) song (Song A) and skip into the middle of the song
  3. Edit tags of Song A (e.g. change Title)
  4. Double-Tap on Save
  5. Start a different song (Song B)
  6. Start Song A again.
  7. Compare duration of Song A before and after editing the tags
MSOB7YY commented 7 months ago

holy shit that's true damn, it seems like the issue happens only when double tapping "save", am i correct? thats obviously due to concurrent writing to the same file, making it corrupted, gonna disable save button while saving have u encountered a similar issue just by tapping "save" (not double tapping) ?

f4b4d1 commented 7 months ago

I tried several times with just tapping once, but it only happend with double tapping. I tapped a second time because saving took a little bit longer for the long songs. After that I thought they were gone (sorted by duration) but they were just shortend.

MSOB7YY commented 7 months ago

now the button will be disabled while saving, sorry for the issues caused. if u want u can use the snapshot build from https://github.com/namidaco/namida/actions/runs/7966602874 (it will be separate version)

f4b4d1 commented 7 months ago

No problem, fourtunately I noticed it early in the process. Thanks for the quick fix and keep up the good work!