kieraneglin / pinchflat

Your next YouTube media manager
GNU Affero General Public License v3.0
789 stars 16 forks source link

[Triage] Files not removed from filesystem when deleting source and metadata profiles in certain order #286

Closed Iliannnn closed 3 months ago

Iliannnn commented 3 months ago

Describe the bug When deleting a source followed by its metadata profile, the associated files are not removed from the filesystem. However, if the metadata profile is deleted first, the files are correctly removed from the filesystem.

To Reproduce Steps to reproduce the behavior:

  1. Click on 'Sources' in the menu bar.
  2. Select the source that you want to delete.
  3. Click on the 'Delete Source + Files' action.
  4. Confirm the deletion.
  5. Click on 'Media Profiles' in the menu bar.
  6. Select the metadata profile that you want to delete.
  7. Confirm the deletion.
  8. Check the filesystem to verify if the files have been removed.
  9. Observe that the files are still present on the filesystem.

Expected behavior When deleting a source and its metadata profile, the associated files should be completely removed from the filesystem regardless of the deletion order.

Screenshots image image image image

Diagnostic info

- App Version: 2024.5.30
- yt-dlp Version: 2024.05.27
- Apprise Version: v1.8.0
- System Architecture: x86_64-pc-linux-gnu
- Timezone: Europe/Brussels

Additional context

➜ tree -P '*.mp4' -a --prune The\ Tren\ Twins
The\ Tren\ Twins
|-- Season\ 2022
|   |-- s2022e082299\ -\ TRENTWIN\ PUSH\ DAY\342\247\270\ GYM\ MOTIVATON.mp4
|   |-- s2022e092099\ -\ PROTEIN\ GROCERY\ HAUL\ -\ TRENTWIN\ PROTEIN\ SPREE.mp4
|   |-- s2022e092499\ -\ NATTY\ TWIN\ BICEP\ PUMP.mp4
|   |-- s2022e100499\ -\ ROAD\ TO\ 450\ BENCH.mp4
|   |-- s2022e102799\ -\ Reject\ weakness,\ embrace\ discipline..mp4
|   |-- s2022e103099\ -\ Trying\ Rich\ Pianas\ arm\ blaster\ workout.mp4
|   |-- s2022e110499\ -\ Full\ bench\ transformation\ 225\ to\ 475\ pounds.mp4
|   |-- s2022e110699\ -\ How\ To\ Train\ Biceps\ for\ Growth.mp4
|   |-- s2022e111099\ -\ The\ best\ workout\ split.mp4
|   |-- s2022e111399\ -\ Full\ day\ of\ eating\ on\ the\ bulk.mp4
|   |-- s2022e111599\ -\ HOW\ TO\ GROW\ A\ SUPERHERO\ CHEST.mp4
|   |-- s2022e111899\ -\ Surviving\ Jay\ Cutlers\ Olympia\ winning\ leg\ day.mp4
|   |-- s2022e112299\ -\ BATMAN\ BACK\ DAY.mp4
|   |-- s2022e112499\ -\ EARNING\ OUR\ THANKSGIVING\ MEAL.mp4
|   |-- s2022e120299\ -\ How\ to\ put\ on\ muscle\ mass\ (\ bulked\ up\ leg\ day).mp4
|   |-- s2022e121299\ -\ HOW\ TO\ EGO-LIFT\ OPTIMALLY.mp4
|   `-- s2022e121799\ -\ Push\ heavy\ weight\ to\ get\ really\ big\ muscles.mp4
|-- Season\ 2023
|   |-- s2023e010599\ -\ MAXIMIZE\ GAINS\ IN\ 2023\ DOING\ THIS.mp4
|   |-- s2023e010899\ -\ 3\ gorillas\ test\ their\ strength.mp4
|   |-- s2023e011199\ -\ INTERNATIONAL\ CHEST\ DAY\ (best\ holiday).mp4
|   |-- s2023e011999\ -\ Breaking\ in\ the\ benches\ at\ zoo\ culture\ 2.mp4
|   |-- s2023e012799\ -\ HOW\ TO\ PR\ W\342\247\270\ LARRY\ WHEELS.mp4
|   |-- s2023e012999\ -\ WE\ ENTERED\ A\ POWERLIFTING\ MEET.mp4
|   |-- s2023e020399\ -\ AN\ ENRAGED\ MANIC\ ARM\ PUMP.mp4
|   |-- s2023e020899\ -\ LIFTING\ HEAVY\ ASS\ WEIGHT,\ OFFICIALLY.mp4
|   |-- s2023e021599\ -\ VALENTINES\ AKA\ BACK\ AND\ BI\ DAY.mp4
|   |-- s2023e022299\ -\ GETTING\ MORE\ JACKED.mp4
|   |-- s2023e030499\ -\ CLASSIC\ TRENTWIN\ CHEST\ DAY.mp4
|   |-- s2023e030999\ -\ ADDICTED\ TO\ LIFTING\ HEAVY\ A\357\274\212\357\274\212\ WEIGHT.mp4
|   |-- s2023e031499\ -\ BICEPS\342\200\246EVERYDAY.mp4
|   |-- s2023e031899\ -\ Our\ least\ manic\ video\ ever\ (we\342\200\231re\ lying).mp4
|   |-- s2023e032599\ -\ PREP\ BEGINS\357\274\232\ BIGGER\ BY\ THE\ DAY.mp4
|   |-- s2023e032999\ -\ BACK\ TO\ THE\ TRENCHES,\ MANIC\ PUMP.mp4
|   |-- s2023e040499\ -\ ATTEMPTING\ TOM\ PLATZ\ INSANE\ LEG\ DAY.mp4
|   |-- s2023e040999\ -\ HOW\ TO\ PROPERLY\ PICK\ UP\ HEAVY\ A\357\274\212\357\274\212\ WEIGHT.mp4
|   |-- s2023e041599\ -\ EGO\ LIFT\ FOR\ GAINS.mp4
|   |-- s2023e042199\ -\ FULL\ DAY\ OF\ EATING\ ON\ PREP.mp4
|   |-- s2023e043099\ -\ OFFICIALLY\ BECOMING\ THE\ TRENTWINS.mp4
|   |-- s2023e050799\ -\ ANABOLIC\ GROCERY\ HAUL\ AND\ WORKOUT.mp4
|   |-- s2023e051799\ -\ Heavy\ weights\ and\ heavier\ topics.mp4
|   |-- s2023e052599\ -\ Therapy\357\274\237\ JUST\ LIFT\ HEAVY\ A\357\274\212\357\274\212\ WEIGHT.mp4
|   |-- s2023e053199\ -\ HOW\ TO\ OPTIMALLY\ TRAIN\ FOR\ BIGGER\ LEGS\ (ego\ lift).mp4
|   |-- s2023e060599\ -\ MEATHEAD\ MONDAY\ (the\ best\ day\ of\ the\ week).mp4
|   |-- s2023e061299\ -\ HOW\ TO\ BUILD\ A\ THICKER\ BACK.mp4
|   |-- s2023e062099\ -\ TRENTWINS\ SHOULDER\ WORKOUT.mp4
|   |-- s2023e062799\ -\ ATTEMPTING\ RICH\ PIANAS\ 8\ HOUR\ ARM\ DAY.mp4
|   |-- s2023e070599\ -\ HEAVY\ A\357\274\212\357\274\212\ BENCH\ SESSION\ (we\ became\ feral).mp4
|   |-- s2023e071299\ -\ The\ hardest\ we\342\200\231ve\ ever\ trained...mp4
|   |-- s2023e072099\ -\ DERANGED\ DEADLIFTS\ (We\ fought\ over\ a\ barbell).mp4
|   |-- s2023e072799\ -\ HOW\ TO\ GET\ BIGGER\ ARMS.mp4
|   |-- s2023e080499\ -\ TRAIN\ INSANE\ OR\ REMAIN\ THE\ SAME.mp4
|   |-- s2023e081399\ -\ TIPS\ FOR\ A\ STRONGER\ BENCH\ (become\ insane).mp4
|   |-- s2023e081899\ -\ ATTEMPTING\ ARNOLDS\ LEGENDARY\ CHEST-DAY.mp4
|   |-- s2023e082899\ -\ Another\ Anabolic\ classic.mp4
|   |-- s2023e090399\ -\ FULL\ DAY\ OF\ EATING\ +\ GOLDS\ VENICE.mp4
|   |-- s2023e091099\ -\ HIGH\ STIM\ AND\ HEAVY\ WEIGHTS.mp4
|   |-- s2023e091399\ -\ IHOPS\ Protein\ Pancakes\ Refeed.mp4
|   |-- s2023e091999\ -\ HEAVY\ TRAP\ AND\ SHOULDER\ WORKOUT.mp4
|   |-- s2023e092499\ -\ CHESTDAY\ BEST\ DAY.mp4
|   |-- s2023e100499\ -\ Deadlifts\ but\ we\ forgot\ we\ were\ recording.mp4
|   |-- s2023e101199\ -\ MOGGING\ AT\ PLANET\ FITNESS.mp4
|   |-- s2023e101799\ -\ INTERNATIONAL\ CHEST\ DAY\ (gym\ bro\ holiday).mp4
|   |-- s2023e102599\ -\ GUNS\ N\342\200\231\ GAINS.mp4
|   |-- s2023e103199\ -\ A\ MANIC\ HALLOWEEN.mp4
|   |-- s2023e110699\ -\ CHEST\ DAY.mp4
|   |-- s2023e111399\ -\ WIDER\ BY\ THE\ DAY\357\274\232\ back\ pump.mp4
|   |-- s2023e112099\ -\ TESTING\ WHICH\ TWIN\ IS\ STRONGER\357\274\232\ SBD.mp4
|   |-- s2023e112399\ -\ GAINSGIVING\ (ARM\ DAY).mp4
|   |-- s2023e112999\ -\ HEAVY\ METAL\ AND\ HEAVIER\ WEIGHT.mp4
|   |-- s2023e120499\ -\ PUSHDAY.mp4
|   |-- s2023e121199\ -\ ANABOLIC\ BACK\ N\342\200\231\ BICEP\ PUMP.mp4
|   |-- s2023e121899\ -\ Depressed\ \357\274\237\ HIT\ ARMS.mp4
|   |-- s2023e122399\ -\ CHEST\ DAY\357\274\232\ STRONGER\ BY\ THE\ DAY.mp4
|   `-- s2023e123099\ -\ Powerlifting\ or\ bodybuilding\357\274\232\ a\ gym\ bro\ guide.mp4
`-- Season\ 2024
    |-- s2024e010499\ -\ HOW\ TO\ BUILD\ DOUBLE\ D\ PECS.mp4
    |-- s2024e010999\ -\ TRYING\ LEE\ PRIEST\342\200\231S\ ANABOLIC\ ARM\ DAY.mp4
    |-- s2024e011599\ -\ FULL\ DAY\ OF\ EATING\ +\ NEW\ CYCLE\360\237\222\211.mp4
    |-- s2024e012099\ -\ Tren\ is\ rotting\ our\ brain.mp4
    |-- s2024e012699\ -\ ROID\ RAGE.mp4
    |-- s2024e020199\ -\ STOP\ NEGLECTING\ THIS\ MUSCLE\ (not\ ur\ Johnson).mp4
    |-- s2024e021299\ -\ HEAVY\ WEIGHT\ CHESTDAY.mp4
    |-- s2024e021899\ -\ EGO\ LIFTING\ BOOSTS\ TEST.mp4
    |-- s2024e022499\ -\ WE\342\200\231RE\ GETTING\ SHREDDED\357\274\232\ Day\ 1.mp4
    |-- s2024e030299\ -\ WE\342\200\231RE\ STILL\ FAT\ (CUT\ DAY\ 2).mp4
    |-- s2024e031099\ -\ WE\ MADE\ OUR\ OWN\ PRE\ WORKOUT\ (STIM\ WARNING).mp4
    |-- s2024e031799\ -\ ATTEMPTING\ LEG\ DAY\ (WE\ HIT\ ARMS\357\274\237).mp4
    |-- s2024e032599\ -\ TIPS\ FOR\ BIGGER\ BICEPS\ (Roids\ not\ required).mp4
    |-- s2024e033199\ -\ LOSE\ WEIGHT\ NOT\ GAINS.mp4
    |-- s2024e040499\ -\ HOME\ GYM\ CHEST\ WORKOUT.mp4
    |-- s2024e041399\ -\ LOSING\ FAT,\ STRENGTH,\ AND\ BRAIN\ CELLS.mp4
    |-- s2024e041999\ -\ ANABOLIC\ REFEED.mp4
    |-- s2024e042699\ -\ THE\ 5\ STAGES\ OF\ CUTTING.mp4
    |-- s2024e042999\ -\ WHO\342\200\231S\ THE\ STRONGER\ TWIN\357\274\237\ Chest\ day.mp4
    |-- s2024e050299\ -\ PLANET\ FITNESS\ ARM\ PUMP.mp4
    |-- s2024e050799\ -\ PREP\ DAY\ 1\357\274\232\ ATTEMPTING\ BODYBUILDING.mp4
    |-- s2024e051299\ -\ STRIATED\ GLUTES\357\274\232\ 7\ weeks\ out.mp4
    |-- s2024e051799\ -\ 2000\ CALORIE\ FULL\ DAY\ OF\ EATING.mp4
    |-- s2024e052099\ -\ We\ Messed\ Up.mp4
    |-- s2024e052499\ -\ HOW\ TO\ GET\ 3D\ SHOULDERS\ (bro\ science).mp4
    `-- s2024e052999\ -\ TRYING\ RICH\ PIANA\342\200\231S\ INSANE\ CHEST\ DAY.mp4

4 directories, 100 files
kieraneglin commented 3 months ago

Thanks for the report!

Out of curiosity, were these files you had upgraded in quality? I see the last date is May 29th which is the date the upload_date -> uploaded_at migration took place which would mean this is the same root cause as #283 (ie: the new files didn't replace the old files and the database stopped tracking the old files)

If that's the case, this should be a one-off issue that's resolved going forward by #284.


There is still #166 that's waiting for a fix in yt-dlp (detailed in #139), but that's a separate root issue that usually displays in only one or two files being left behind

Iliannnn commented 3 months ago

Yes, they were.

kieraneglin commented 3 months ago

In that case I'll close this issue since it's been resolved going forward 🤙