Skip to content
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

[FR] Update name / location of previously downloaded files according to output path template changes #408

Open
reneil1337 opened this issue Oct 9, 2024 · 5 comments
Assignees

Comments

@reneil1337
Copy link

I'd love to be able to apply updates of "output path template" changes to all files that were already downloaded via Pinchflat. The renaming/moving of previously downloaded files could happen as the user saves changes of the media profile they are editing. This would massively help to handle archived media without breaking Pinchflat pipelines.

@kieraneglin
Copy link
Owner

Hey there! Thanks for the report (:

This is a fair idea, but unfortunately not a super simple one. I'm going to be (mostly) out of cell service for just over a week starting tomorrow, but I'll take a look once I'm back and see if there's a simple path forward!

@giantsfan006
Copy link

Came here to suggest this. I'm doing some testing to get things working right and after a few dozen downloads I realized I wasn't getting season folders. While it would be awesome to be able to just change the format in the profiles page it would also be beneficial to have a nuclear option that deletes everything and starts fresh. Would simply pointing Pinchflat at a new empty downloads directory work?

@kieraneglin
Copy link
Owner

Hey all! I'm back from my trip and I'll be looking into this later this week. There are a few bugfixes I need to address first but I'll resume looking into this once those are resolved 🤙

it would also be beneficial to have a nuclear option that deletes everything and starts fresh. Would simply pointing Pinchflat at a new empty downloads directory work?

You'd have to also nuke the /config directory, but it's probably better to go to a source in-app and click Actions > Delete Source + Files. Or you could delete the download directory for that source's specific files and choose Actions > Sync Files on Disk

@bverkron
Copy link

Would also love this feature. Trying to implement Pinchflat but have had to change the pathing multiple times during my setup as I discover how Pinchflat works, how it integrates with Jellyfin, what certain profile options mean, etc. I've had to nuke things a few times and it would be great if Punchflat could handle this without having to nuke or write my own scripts to port things over to the new pathing structure.

@lukyjay
Copy link

lukyjay commented Jan 17, 2025

Hello, I am migrating my media to Tube Archivist from Pinchflat. I am sure I will be back, but I wanted to share the process I created with some assistance from AI as I might achieve what you want.

  1. SSH into your server and install sqlite3 if you haven't already
  2. Go to your Pinchflat database and run: sqlite3 pinchflat.db
  3. Run these commands in sqlite3:
  4. .mode csv
  5. .output export.csv
  6. select media_id, media_filepath from media_items;
  7. .output stdout
  8. You can quit by spamming ctrl+c
  9. Now you'll have a CSV in the current folder. The filepath will be from your docker containers perspective, so rename those (e.g. mine is /downloads/shows -> /pve1storage/Media/YouTube/shows so I use: sed 's/\/downloads\//\/pve1storage\/Media\/YouTube\//' export.csv > new_export.csv
  10. Create a new bash file with the below contents
  11. Make it executable (chmod +x file.sh)
  12. Run it - once happy with the output, uncomment the mv command and re-run it to rename and move your media
#!/bin/bash

while IFS=, read -r id filepath; do
  # Skip empty lines
  if [[ -z "$id" || -z "$filepath" ]]; then
    continue
  fi

  # Remove quotes from id and filepath
  filepath=$(echo "$filepath" | tr -d '"')
  id=$(echo "$id" | tr -d '"')

  # Remove carriage return from filepath
  filepath="${filepath//$'\r'/}"

  # Extract the directory name from the filepath
  directory=$(dirname "$filepath")

  # Extract the parent directory of the directory
  parent_directory=$(dirname "$directory")

  # Debug: Print the values to check for accuracy
  echo "Filepath: $filepath"
  echo "ID: $id"
  echo "Target: $parent_directory/$id.mp4"

  # Rename the file using rsync
  rsync -av "$filepath" "$parent_directory/$id.mp4"

done < new_export.csv

The result for me:

Old: "/pve1storage/Media/YouTube/shows/Linus Tech Tips/Season 2023/s2023e090799 - Thank you for not spitting in my face – AMD Radeon RX 7700 XT & 7800 XT Review.mp4"

New: "/pve1storage/Media/YouTube/shows/Linus Tech Tips/gggehz298L8.mp4

This will surely help with what you're trying to do above. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants