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

Mass Processing Files #15

Closed
angrycuban13 opened this issue Jan 3, 2021 · 7 comments
Closed

Mass Processing Files #15

angrycuban13 opened this issue Jan 3, 2021 · 7 comments
Assignees

Comments

@angrycuban13
Copy link

angrycuban13 commented Jan 3, 2021

Hi,

I couldn't find a way to "mass process" existing files and using tab autocompletion on any existing library would take quite a bit of time.

I couldn't get it to work with bash for some reason but managed to hack something up on Powershell. I don't know if you are interested in adding it on the README.md

Paths would need to be changed in a per user's basis. Also keep in mind, I'm running these Powershell comamnds on the root of the drive where my media is. If you wish to not do that, you'd just need to adjust the path for where your media.txt will be output to.

#First we find all our .mkv files
Get-ChildItem -Recurse -Filter '*.mkv' | Group-Object "FullName" | Select-Object Name  | Out-File media.txt
#Now we need to change the Windows path to where Stripparr expects the media to be
(Get-Content .\media.txt -Raw) -replace [Regex]::Escape('X:\'), '/storage/media/' | Out-File media.txt
#We have some more replacing to do
(Get-Content .\media.txt -Raw) -replace [Regex]::Escape('\'), '/' | Out-File media.txt    
#We need to surround every line with quotation marks to account for spaces
(Get-Content .\media.txt) -replace '^|$', '"' | Out-File .\media.txt

Afterwards, I manually grabbed the manually_process.py file from my appdata folder or you can get it from here and modified line 34 to point to where Striparr is listening on my docker host:

r = requests.post('http://192.168.4.15:40000/', json=request_json)

And last but not least, we send the request to Striparr:

$movies = [System.IO.File]::ReadLines(".\media.txt")

foreach ($movie in $movies) {
    python.exe .\scripts\python\remove_metadata.py $movie
}

Originally I had done the first portion in bash thanks to @tronyx. Here's how:

#Change the path to where your media resides on the host
find /mnt/media/ -name "*.mkv" > media.txt

#Change the media paths to where the container expects the media to be
sed -i 's|/mnt/media|/storage/media|g' media.txt

#Surround each line with "" to account for spaces
sed -i 's/\(.*\)/"\1"/g' media.txt
@mikenye mikenye self-assigned this Jan 3, 2021
@mikenye
Copy link
Owner

mikenye commented Jan 7, 2021

Very ingenious of you - nice work.

Would you mind if I updated the readme linking to this issue?

@angrycuban13
Copy link
Author

angrycuban13 commented Jan 7, 2021

Not at all, please do!

The bash portion could not be possible without the help of @tronyx

mikenye added a commit that referenced this issue Jan 8, 2021
@mikenye
Copy link
Owner

mikenye commented Jan 8, 2021

Thanks!

@mikenye mikenye closed this as completed Jan 8, 2021
@DrSeussFreak
Copy link

DrSeussFreak commented Apr 12, 2021

I run linux, so I wrote a simple bash script to utilize the commands above, added a loop and I ran this from within my container. This worked for me!

#!/bin/bash

#thanks [tronyx](https://github.com/mikenye/docker-striparr/issues/15#issuecomment-818048024)
find /media/TV/ /media/Movies/ -type f \( -iname \*.mkv -o -iname \*.mp4 \) > media.txt

file="media.txt"
while IFS= read line
do
        "/manually_process.py" echo "$line"
done <"$file"

Note: Just change the directory paths

@tronyx
Copy link

tronyx commented Apr 12, 2021

You can simplify your find command greatly as follows:

find /media/TV/ /media/Movies/ -type f \( -iname \*.mkv -o -iname \*.mp4 \) > media.txt

@DrSeussFreak
Copy link

I was playing around with it, but got lazy ;) I just updated my comment

@mikenye mikenye reopened this Apr 12, 2021
@mikenye mikenye closed this as completed May 21, 2021
@felipefmartinez
Copy link

for bash you can do this pretty simply by going into the docker with:

docker exec -it striparr sh

once in there you can ls around and find your media. let's assume I have all my media in a folder called media for the sake of this exercise.

now you can easily strip all mkvs like this, one line.

find /media -type f -exec /manually_process.py {} ;

this will process all files in the /media folder. if you want to only process mkv adjust it like so

find /media -type f -name '*.mkv' -exec /manually_process.py {} ;

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

No branches or pull requests

5 participants