jpillora / media-sort

Automatically organise your movies and tv series
MIT License
120 stars 21 forks source link

option to use folder names instead of file names #2

Closed nightmare-rg closed 4 years ago

nightmare-rg commented 7 years ago

hello,

i would prefer an option to switch to parent directory name for search and rename.

scene releases are named in a short version, so media-sort could not find the right information.

for example:

2016/11/24 14:52:20 [#29/52] Mr.Right.2015.German.720p.BluRay.x264-ENCOUNTERS/encounters-mrri_720p.mkv └─> No results (Google search failed)

filename: encounters-mrri_720p.mkv -> no chance to get the right information parent dir name: Mr.Right.2015.German.720p.BluRay.x264-ENCOUNTERS -> all information are here

with correct file names it works like a charm:

2016/11/24 14:52:20 [#32/52] Pixels.2015.German.DTS.DL.720p.BluRay.x264-HQX/Pixels.2015.German.DTS.DL.720p.BluRay.x264-HQX.mkv └─> Pixels (2015).mkv

So i use at the moment a work arround via bash, but it is an ugly way to do this:

find . -type f -not -name test.sh | while read file
do
    dirname="$(dirname "$file")"
    new_name="${dirname##*/}"
    file_ext=${file##*.}
    if [ -n "$file_ext" -a  -n "$dirname" -a -n "$new_name" ]
    then
        echo "mv '$file' '$dirname/$new_name.$file_ext'"
    fi
done
wreckedred commented 7 years ago

Hey thanks

On Thu, Nov 24, 2016 at 7:13 AM, nightmare notifications@github.com wrote:

hello,

i would prefer an option to switch to parent directory name for search and rename.

scene releases are named in a short version, so media-sort could not find the right information.

for example:

2016/11/24 14:52:20 [#29/52] Mr.Right.2015.German.720p. BluRay.x264-ENCOUNTERS/encounters-mrri_720p.mkv └─> No results (Google search failed)

filename: encounters-mrri_720p.mkv -> no chance to get the right information parent dir name: Mr.Right.2015.German.720p.BluRay.x264-ENCOUNTERS -> all information are here

with correct file names it works like a charm:

2016/11/24 14:52:20 [#32/52] Pixels.2015.German.DTS.DL. 720p.BluRay.x264-HQX/Pixels.2015.German.DTS.DL.720p.BluRay.x264-HQX.mkv └─> Pixels (2015).mkv

So i use at the moment a work arround via bash, but it is an ugly way to do this:

find . -type f -not -name test.sh | while read file do dirname="$(dirname "$file")" new_name="${dirname##/}" file_ext=${file##.} if [ -n "$file_ext" -a -n "$dirname" -a -n "$new_name" ] then echo "mv '$file' '$dirname/$new_name.$file_ext'" fi done

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpillora/media-sort/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AKixh_vvDcHfXS6rCDWWGq2go2n4NT6Dks5rBZumgaJpZM4K7sYY .

rotsix commented 4 years ago

Hey. I'm facing the same issue, with some files named Name.Season/Episode.ext.

This is caused by /sort/path_sort.go:runPathSort sending the file name only (e.g. Episode.ext) (related code).

Some simple solutions are:

rotsix commented 4 years ago

Hi all, The best solution would be to add an option specifying the number of folders to include.

  --num-folders, -n      number of folders to include in search (default 0)

Backward compatibility is guaranteed as -n 0 is current behavior.

Edit: if the number is too big, it only includes up to the <target> folder.

jpillora commented 4 years ago

Not a bad idea, so just concatenate last N folders and the filename, and use that as the search query?

On Sat, 11 Jul 2020 at 4:07 am Victor Franzi notifications@github.com wrote:

Hi all, The best solution would be to add an option specifying the number of folders to include.

--num-folders, -n number of folders to include in search (default 0)

Backward compatibility is guaranteed as -n 0 is current behavior.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpillora/media-sort/issues/2#issuecomment-656810814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2X46IOPVOO4I23ICJ6ITR25KHHANCNFSM4CXOYYMA .

rotsix commented 4 years ago

Yep that should cover most use-cases.

jpillora commented 4 years ago

Release https://github.com/jpillora/media-sort/releases/tag/v2.6.0 in progress

jpillora commented 4 years ago

Added --num-dirs, -n num ber of directories to include in search (default 0 where -1 means all dirs)

jpillora commented 4 years ago

Released https://github.com/jpillora/media-sort/releases/tag/v2.6.2 test had windows path bug -_-