Mailing List Archive

1 2  View All
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Sun, Oct 23, 2022 at 01:35:55AM -0500 schrieb Dale:

> Well, I ran into a slight problem.  This isn't much of a problem with
> Linux but I'm not sure how this would work on windoze tho.  The problem,
> if it is one, is the file extension.  Let's say I have a mp4 file that
> is the older original file that I intend to replace.  If the file I
> intend to put in its place is a .mkv file, mv uses the .mp4 extension
> because all it cares about is the name of the file, not what it is or
> its content.  So, I end up with a .mkv file that has a .mp4 extension. 
> It works here on Linux but not sure about windoze and such.

It’s not a problem for as long as the application you open the file with
does its own detection. I.e. you feed mp4 to mpv, but it recognises by
itself that it’s mp4 and can handle it.

> I looked at the man page and I don't see a way to tell it to retain the
> extension.  I see something about suffix but I don't think that is
> related to this.  If I just backspace and change the extension, it
> basically moves the file and I end up with both the old and new file.  I
> wish I could write code and create a tool for this.  :/ 
>
> Is there a way to work around this problem?  It works great except for
> losing the file extension. 

If you still want to stick to a terminal solution akin to mv, then there is
no way around a little script which wraps mv by extracting the extension and
filename base. You could also add some “intelligence” with regards to
directories, in order to reduce the amount of effort required to use the
command—in case your directories follow some schema or are constant.


#!/usr/bin/sh

[ "$#" -ne "2" ] && exit 1
SRC="$1"
DST="$2"

SRC_EXT="${SRC##*.}"
DST_BASE="${DST%.*}"

# remove destination for the case that the extensions differ
rm "$DST"

mv "$SRC" "${DST_BASE}${SRC_EXT}"

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

“If you enjoy wasting time, is that time really wasted?” – Philosoraptor
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> Am Sun, Oct 23, 2022 at 01:35:55AM -0500 schrieb Dale:
>
>> Well, I ran into a slight problem.  This isn't much of a problem with
>> Linux but I'm not sure how this would work on windoze tho.  The problem,
>> if it is one, is the file extension.  Let's say I have a mp4 file that
>> is the older original file that I intend to replace.  If the file I
>> intend to put in its place is a .mkv file, mv uses the .mp4 extension
>> because all it cares about is the name of the file, not what it is or
>> its content.  So, I end up with a .mkv file that has a .mp4 extension. 
>> It works here on Linux but not sure about windoze and such.
> It’s not a problem for as long as the application you open the file with
> does its own detection. I.e. you feed mp4 to mpv, but it recognises by
> itself that it’s mp4 and can handle it.

That is true on Linux.  Most linux software could care less what the
extension is or if it even has one.  Heck, you could likely change a
.mp4 to .txt and it would open with a video player just by clicking on
it.  Thing is, if I share a file with someone who uses windoze, I'm not
sure if it would work the same way.  A wrong extension could cause
problems, either not opening at all or crashing something.  It's
windoze, one can't expect much.  ROFL 

I thought about looking to see if there is a way to "scan" a directory
and look at each file and if needed, change the extension to the correct
one.  Thing is, I couldn't write a fancy script if my life depended on
it.  I also looked into using Krename to do it but it refuses to change
a extension.  Doing it one file at a time manually puts me back to where
it is easier to change the file the old way.  Time consuming but works. 


>> I looked at the man page and I don't see a way to tell it to retain the
>> extension.  I see something about suffix but I don't think that is
>> related to this.  If I just backspace and change the extension, it
>> basically moves the file and I end up with both the old and new file.  I
>> wish I could write code and create a tool for this.  :/ 
>>
>> Is there a way to work around this problem?  It works great except for
>> losing the file extension. 
> If you still want to stick to a terminal solution akin to mv, then there is
> no way around a little script which wraps mv by extracting the extension and
> filename base. You could also add some “intelligence” with regards to
> directories, in order to reduce the amount of effort required to use the
> command—in case your directories follow some schema or are constant.
>
>
> #!/usr/bin/sh
>
> [ "$#" -ne "2" ] && exit 1
> SRC="$1"
> DST="$2"
>
> SRC_EXT="${SRC##*.}"
> DST_BASE="${DST%.*}"
>
> # remove destination for the case that the extensions differ
> rm "$DST"
>
> mv "$SRC" "${DST_BASE}${SRC_EXT}"
>


Hmmmm.  I get a little of that but then I get lost.  Just how does that
work and how would I use it?  I think I would save that as a file, make
it executable and then run it with whatever name I give it.  I'm not
sure exactly how to tell it what files to move tho.  Same as mv maybe? 

Currently, I move to the main directory that files are in when I am in
Konsole and running as my user, so file permissions don't switch to
root.  My process on file organizing goes a little like this.  I have a
set of videos that go together.  When I have a new version of one or
more videos, I place them in a sub-directory until they are named
properly or something so I can move to the main directory.  Like this:

Main Directory  #Permanent location for files
----- Sub-directory  #Temporary location for files needing names changed
etc.  Once done, they move up to main directory.


A typical command for mv would be like this.

mv sub-directory/<file name of new file> <file name of old file in main
directory>

Just trying to follow this and figure out how to use it.  ;-)  I've said
this before, my scripting skills are so small it isn't funny.  :/

Dale

:-)  :-) 
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Sun, Oct 23, 2022 at 06:16:04AM -0500 schrieb Dale:
> Frank Steinmetzger wrote:
> > Am Sun, Oct 23, 2022 at 01:35:55AM -0500 schrieb Dale:
> >
> >> Well, I ran into a slight problem.  This isn't much of a problem with
> >> Linux but I'm not sure how this would work on windoze tho.  The problem,
> >> if it is one, is the file extension.  Let's say I have a mp4 file that
> >> is the older original file that I intend to replace.  If the file I
> >> intend to put in its place is a .mkv file, mv uses the .mp4 extension
> >> because all it cares about is the name of the file, not what it is or
> >> its content.  So, I end up with a .mkv file that has a .mp4 extension. 
> >> It works here on Linux but not sure about windoze and such.
> > It’s not a problem for as long as the application you open the file with
> > does its own detection. I.e. you feed mp4 to mpv, but it recognises by
> > itself that it’s mp4 and can handle it.
>
> That is true on Linux.  Most linux software could care less what the
> extension is or if it even has one.

Mpv or Vlc on Windows will probably just work™, too.

> Heck, you could likely change a
> .mp4 to .txt and it would open with a video player just by clicking on
> it.  Thing is, if I share a file with someone who uses windoze, I'm not
> sure if it would work the same way.  A wrong extension could cause
> problems, either not opening at all or crashing something.  It's
> windoze, one can't expect much.  ROFL 

Now you’re talking about double-clicking in a file manager and open the
registered application. That’s the same—to some extent—on Linux file
managers. I was referring to an application that could work out the details.

> I thought about looking to see if there is a way to "scan" a directory
> and look at each file and if needed, change the extension to the correct
> one.  Thing is, I couldn't write a fancy script if my life depended on
> it.  I also looked into using Krename to do it but it refuses to change
> a extension.  Doing it one file at a time manually puts me back to where
> it is easier to change the file the old way.  Time consuming but works. 

Well, ther is the `file` tool, plus maybe `mediainfo` or `identify` for
images. But their output may not always be sufficient.

> > If you still want to stick to a terminal solution akin to mv, then there
> > is no way around a little script which wraps mv by extracting the
> > extension and filename base.

> Hmmmm.  I get a little of that but then I get lost.

The script first checks wheter it receives exactly two arguments, and exits
otherwise. In theory it should also check whether both paths exist and are
files. First rule of programming: always sanitise your inputs!

Now it gets the extension of the source file and the base part (i.e.
everything without the extension) from the destination. Then it deletes the
original destination file and finally moves the source by concatenating the
original destination’s base part with the source’s extension part.


>   Just how does that work and how would I use it?

I have a lot of little helper scripts. I collect them in ~/usr/bin, to which
my PATH is expanded in ~/.bashrc with export PATH=~/usr/bin:$PATH. Actually,
I keep the script files in git repositories under ~/dev, and then put
symlinks into ~/usr/bin, which point to the repository file.

> I think I would save that as a file, make it executable and then run it
> with whatever name I give it.

Exactly.

> I'm not sure exactly how to tell it what files to move tho.  Same as mv
> maybe? 

Yes. You give it two arguments. That’s what $1 and $2 are for in the script.
I always write my scripts so that they can handle spaces in filenames. I
find it an anachronism to still use underscores or dots in filenames where
spaces would go in normal language. File systems have been able to deal with
spaces for decades now.

> Currently, I move to the main directory that files are in when I am in
> Konsole and running as my user, so file permissions don't switch to root. 

That’s the proper way to do it. I also have a root console open all the
time, but don’t do normal file operations in there. The risk is too big that
I may be typing too fast for my own good.

> My process on file organizing goes a little like this.  I have a set of
> videos that go together.  When I have a new version of one or more videos,
> I place them in a sub-directory until they are named properly or something
> so I can move to the main directory.  Like this:
>
> Main Directory  #Permanent location for files ----- Sub-directory 
> #Temporary location for files needing names changed etc.  Once done, they
> move up to main directory.

I don’t quite understand the formatting of that line. But basically, you
have a directory for your videos, and in a subdiractory of that, you collect
your temporary files?

> A typical command for mv would be like this.
>
> mv sub-directory/<file name of new file> <file name of old file in main
> directory>

OK. That could actually be automated in a way. How many files per directory
are we talking about? Because one approach I can think of is a managament
script. It goes through all the files in your temp subdir, and for each file
it asks you which file to overwrite in the main directory. It then moves the
file, but keeps the extension as in my first script. But this isn’t
practical if there are dozens of files in the main dir, because you would
have to scroll through the big selection ist.

As an example, let’s assume we have the following file tree:

main
??? episode 1.mkv
??? episode 2.mpeg
??? episode 3.avi
??? temp
??? episode 2 with better quality.mkv

You cd into main, and start the script. It checks for the presence of the
temp dir and, if it exists, asks for each of its files what to do:

main$ VideoCleanupScript
Select file to overwrite with 'episode 2 with better quality.mkv':
1) episode 1.mkv
2) episode 2.mpeg
3) episode 3.avi
#? 2
Removing 'episode 2.mpeg'
Moving file 'episode 2 with better quality.mkv' -> 'episode 2.mkv'

> Just trying to follow this and figure out how to use it.  ;-)  I've said
> this before, my scripting skills are so small it isn't funny.  :/

I could write the above script in probably half an hour. Just say when. ;-)

I, too, have a few scripts that move files around. For example when I edit
photo albums, I do a final re-encoding of those images in different JPEG
quality levels as a trade-off between quality and storage space. For that I
have a script that asks me which level to keep whilst I look at the
different versions in a viewer. I then decide for one and the script picks
the appropriate file and moves it into the final folder. The other choices
are moved away so that if I halt the script midway, I can call it again and
pick up where I left it.

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

Of all the people I’ve met you’re certainly one of them.
Re: Dolphin and adding a option, if it exists. [ In reply to ]
On 2022-10-23, Dale <rdalek1967@gmail.com> wrote:

> That is true on Linux.  Most linux software could care less what the
> extension is or if it even has one.  Heck, you could likely change a
> .mp4 to .txt and it would open with a video player just by clicking on
> it.  Thing is, if I share a file with someone who uses windoze, I'm not
> sure if it would work the same way.  A wrong extension could cause
> problems, either not opening at all or crashing something.  It's
> windoze, one can't expect much.  ROFL 

A friend of mine once spent days trying to re-encode a video file into
a format that could be handled by a particular windows app. No matter
what codecs/parameters he tried, the app couldn't open the file. He
finally figured out that the app in question had hard requirements for
the filename suffix, and they chose a somewhat non-nstandard extension
for that container format.

It turned out that any of the codec/parameter combinations would have
been fine, it was just the filename that was causing the problem.

--
Grant
Re: Re: Dolphin and adding a option, if it exists. [ In reply to ]
On Monday, 24 October 2022 14:49:46 BST Grant Edwards wrote:
> On 2022-10-23, Dale <rdalek1967@gmail.com> wrote:
> > That is true on Linux. Most linux software could care less what the
> > extension is or if it even has one. Heck, you could likely change a
> > .mp4 to .txt and it would open with a video player just by clicking on
> > it. Thing is, if I share a file with someone who uses windoze, I'm not
> > sure if it would work the same way. A wrong extension could cause
> > problems, either not opening at all or crashing something. It's
> > windoze, one can't expect much. ROFL
>
> A friend of mine once spent days trying to re-encode a video file into
> a format that could be handled by a particular windows app. No matter
> what codecs/parameters he tried, the app couldn't open the file. He
> finally figured out that the app in question had hard requirements for
> the filename suffix, and they chose a somewhat non-nstandard extension
> for that container format.
>
> It turned out that any of the codec/parameter combinations would have
> been fine, it was just the filename that was causing the problem.

So the hubris of those two college dropouts still haunts the Windows world.
What a legacy.

--
Regards,
Peter.
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> Am Sun, Oct 23, 2022 at 01:35:55AM -0500 schrieb Dale:
>
>> Well, I ran into a slight problem.  This isn't much of a problem with
>> Linux but I'm not sure how this would work on windoze tho.  The problem,
>> if it is one, is the file extension.  Let's say I have a mp4 file that
>> is the older original file that I intend to replace.  If the file I
>> intend to put in its place is a .mkv file, mv uses the .mp4 extension
>> because all it cares about is the name of the file, not what it is or
>> its content.  So, I end up with a .mkv file that has a .mp4 extension. 
>> It works here on Linux but not sure about windoze and such.
> It’s not a problem for as long as the application you open the file with
> does its own detection. I.e. you feed mp4 to mpv, but it recognises by
> itself that it’s mp4 and can handle it.
>
>> I looked at the man page and I don't see a way to tell it to retain the
>> extension.  I see something about suffix but I don't think that is
>> related to this.  If I just backspace and change the extension, it
>> basically moves the file and I end up with both the old and new file.  I
>> wish I could write code and create a tool for this.  :/ 
>>
>> Is there a way to work around this problem?  It works great except for
>> losing the file extension. 
> If you still want to stick to a terminal solution akin to mv, then there is
> no way around a little script which wraps mv by extracting the extension and
> filename base. You could also add some “intelligence” with regards to
> directories, in order to reduce the amount of effort required to use the
> command—in case your directories follow some schema or are constant.
>
>
> #!/usr/bin/sh
>
> [ "$#" -ne "2" ] && exit 1
> SRC="$1"
> DST="$2"
>
> SRC_EXT="${SRC##*.}"
> DST_BASE="${DST%.*}"
>
> # remove destination for the case that the extensions differ
> rm "$DST"
>
> mv "$SRC" "${DST_BASE}${SRC_EXT}"
>

I finally got a chance to try this.  I saved it and made it executable. 
It runs but gave me this error. 


dmv torrent/video_name-old-place.mp4 video-name-new-place.mp4
bash: /bin/dmv: /usr/bin/sh: bad interpreter: No such file or directory
dale@fireball ~/Desktop/Crypt/Series $


My scripting skills are minimal at best.  Still, I kinda got what your
script was doing.  Those who have known me for a while understand how
miraculous that is.  ROFL  I did some googling.  It seems to not be able
to find the 'shebang' part.  Sure enough, sh isn't located in /usr/bin
here.  It's in /bin tho.  I edited that line so it can find it.  When I
tried it, it worked but noticed another problem.  It was leaving out the
dot, ".", before the extension.  Back into the script I went.  I revved
up my gears for a bit and made a edit.  When I tried it again, I was
shocked.  I almost fell in the floor.  Dang thing worked perfectly with
me only having to edit once.  I really did get how the script works,
sort of.  O_O 

This is the script as shown by cat:


root@fireball / # cat /bin/dmv
#!/bin/sh

[ "$#" -ne "2" ] && exit 1
SRC="$1"
DST="$2"

SRC_EXT="${SRC##*.}"
DST_BASE="${DST%.*}"

# remove destination for the case that the extensions differ
rm "$DST"

mv "$SRC" "${DST_BASE}.${SRC_EXT}"
root@fireball / #


I added a little . on that last line before the extension bit.  I'm a
happy camper.  Only thing is, turns out both source and destination file
have the same extension in this case.  Still, I bet it will work.  Then
I thought of a way to test this.  I just changed the extension on the
destination file and did a move.  I changed the .mp4 to .mkv on the
destination.  When I used your move script, it used the .mp4 extension
from the original source file but used the old name.  Perfect!!

Hope this makes the point.  THANK YOU MUCH!!!!

Dale

:-)  :-)
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Tue, Nov 22, 2022 at 03:59:27AM -0600 schrieb Dale:

> > If you still want to stick to a terminal solution akin to mv, then there is
> > no way around a little script which wraps mv by extracting the extension and
> > filename base. You could also add some “intelligence” with regards to
> > directories, in order to reduce the amount of effort required to use the
> > command—in case your directories follow some schema or are constant.
> >
> >
> > #!/usr/bin/sh
> >
> > [ "$#" -ne "2" ] && exit 1
> > SRC="$1"
> > DST="$2"
> >
> > SRC_EXT="${SRC##*.}"
> > DST_BASE="${DST%.*}"
> >
> > # remove destination for the case that the extensions differ
> > rm "$DST"
> >
> > mv "$SRC" "${DST_BASE}${SRC_EXT}"
> >
>
> I finally got a chance to try this.  I saved it and made it executable. 
> It runs but gave me this error. 
>
>
> dmv torrent/video_name-old-place.mp4 video-name-new-place.mp4
> bash: /bin/dmv: /usr/bin/sh: bad interpreter: No such file or directory
> dale@fireball ~/Desktop/Crypt/Series $
>
>
> My scripting skills are minimal at best.  Still, I kinda got what your
> script was doing.  Those who have known me for a while understand how
> miraculous that is.  ROFL  I did some googling.  It seems to not be able
> to find the 'shebang' part.  Sure enough, sh isn't located in /usr/bin
> here.  It's in /bin tho.  I edited that line so it can find it.  When I
> tried it, it worked but noticed another problem. […]

Well, it would have been boring to provide you with a turn-key solution. ;-)
Congrats on getting it working. In my Arch setup, sh is in /usr/bin. A
flexible solution is to use #!/usr/bin/env sh, which looks the command up
before executing it.

> I added a little . on that last line before the extension bit.  I'm a
> happy camper.

Give me a nudge if you want the more luxurious version with interactive
selection of the overwrite destination. I think I already started a
prototype somewhere, but can’t find it right now.

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

The best thing about Sundays is Saturday evening.
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> Am Tue, Nov 22, 2022 at 03:59:27AM -0600 schrieb Dale:
>
>>> If you still want to stick to a terminal solution akin to mv, then there is
>>> no way around a little script which wraps mv by extracting the extension and
>>> filename base. You could also add some “intelligence” with regards to
>>> directories, in order to reduce the amount of effort required to use the
>>> command—in case your directories follow some schema or are constant.
>>>
>>>
>>> #!/usr/bin/sh
>>>
>>> [ "$#" -ne "2" ] && exit 1
>>> SRC="$1"
>>> DST="$2"
>>>
>>> SRC_EXT="${SRC##*.}"
>>> DST_BASE="${DST%.*}"
>>>
>>> # remove destination for the case that the extensions differ
>>> rm "$DST"
>>>
>>> mv "$SRC" "${DST_BASE}${SRC_EXT}"
>>>
>> I finally got a chance to try this.  I saved it and made it executable. 
>> It runs but gave me this error. 
>>
>>
>> dmv torrent/video_name-old-place.mp4 video-name-new-place.mp4
>> bash: /bin/dmv: /usr/bin/sh: bad interpreter: No such file or directory
>> dale@fireball ~/Desktop/Crypt/Series $
>>
>>
>> My scripting skills are minimal at best.  Still, I kinda got what your
>> script was doing.  Those who have known me for a while understand how
>> miraculous that is.  ROFL  I did some googling.  It seems to not be able
>> to find the 'shebang' part.  Sure enough, sh isn't located in /usr/bin
>> here.  It's in /bin tho.  I edited that line so it can find it.  When I
>> tried it, it worked but noticed another problem. […]
> Well, it would have been boring to provide you with a turn-key solution. ;-)
> Congrats on getting it working. In my Arch setup, sh is in /usr/bin. A
> flexible solution is to use #!/usr/bin/env sh, which looks the command up
> before executing it.
>
>> I added a little . on that last line before the extension bit.  I'm a
>> happy camper.
> Give me a nudge if you want the more luxurious version with interactive
> selection of the overwrite destination. I think I already started a
> prototype somewhere, but can’t find it right now.
>


Feel free to share.  Even if I don't use it, someone else may find it
and make good use of it.  It's one reason I posted the corrected version
and why I changed what I did.  Someone else just may run up on this and
find it helpful as well.  If possible and you have time, describe a bit
what each part does. 

Usually when I do this, I have several videos, anywhere from 10 to
sometimes 30 or more.  Sometimes I wish it could 'detect' which new one
goes with which old one.  Thing is, I don't know if a script can do this
or not.  Sometimes the new is named pretty different from the old.  I
don't think a script could do it reliably.  If things were more
consistent, maybe, but there is a lot of differences at times.  Your
scripts at least keeps the extension correct without adding any more
effort on my part, except having to type dmv instead of mv.  I chose d
since the first letter of my name is d.  It was something.  lol 

The current script sure is handy tho. 

Dale

:-)  :-) 
Re: Dolphin and adding a option, if it exists. [ In reply to ]
On 22/11/2022 10:07, Frank Steinmetzger wrote:
>> My scripting skills are minimal at best.  Still, I kinda got what your
>> script was doing.  Those who have known me for a while understand how
>> miraculous that is.  ROFL  I did some googling.  It seems to not be able
>> to find the 'shebang' part.  Sure enough, sh isn't located in /usr/bin
>> here.  It's in /bin tho.  I edited that line so it can find it.  When I
>> tried it, it worked but noticed another problem. […]

> Well, it would have been boring to provide you with a turn-key solution. ????
> Congrats on getting it working. In my Arch setup, sh is in /usr/bin. A
> flexible solution is to use #!/usr/bin/env sh, which looks the command up
> before executing it.
>
Everything should be in /usr/bin. /bin should be a symlink to /usr/bin I
believe.

People like to blame that on systemd, but actually I believe the
"change" predates systemd, and certainly has nothing whatsoever to do
with Lennart.

Most distros (especially systemd ones) are already there, Gentoo is
actively migrating in that direction.

And as someone who got bitten by that - writing a makefile (make
install) - on Gentoo and then having it blow up on SUSE, that day can't
come soon enough.

Cheers,
Wol
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Tue, Nov 22, 2022 at 06:17:09AM -0600 schrieb Dale:
> Frank Steinmetzger wrote:

> >> I added a little . on that last line before the extension bit.  I'm a
> >> happy camper.
> > Give me a nudge if you want the more luxurious version with interactive
> > selection of the overwrite destination. I think I already started a
> > prototype somewhere, but can’t find it right now.
> >
>
> Feel free to share.  Even if I don't use it, someone else may find it
> and make good use of it.


There ya goo. As I suspected, I already wrote most of it in October right
away, I only couldn’t find the file until now. I just had to fix the same
bugs as in the first script (and some more in the additional parts :D ),
and put some more grease into the interal logic and output strings.

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

“To some degree people say you should not micro-optimise.
But if what you love is micro-optimisation, that’s what you should do.”
– Linus Torvalds
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> There ya goo. As I suspected, I already wrote most of it in October right
> away, I only couldn?t find the file until now. I just had to fix the same
> bugs as in the first script (and some more in the additional parts :D ),
> and put some more grease into the interal logic and output strings.
>


I saved it and then tried to figure it out.? I got lost.? I see the
commented sections which kinda help I guess but still got lost.?

What does it try to do in simple terms?? Or, how would I use it may be a
better question??

I been using the other script and it is coming in very handy.? It saves
me quite a bit of time.?

Dale

:-)? :-)?
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Wed, Nov 23, 2022 at 05:54:30AM -0600 schrieb Dale:
> Frank Steinmetzger wrote:
> > There ya goo. As I suspected, I already wrote most of it in October right
> > away, I only couldn?t find the file until now. I just had to fix the same
> > bugs as in the first script (and some more in the additional parts :D ),
> > and put some more grease into the interal logic and output strings.
> >
>
> I saved it and then tried to figure it out.  I got lost.  I see the
> commented sections which kinda help I guess but still got lost. 

I was kinda verbose on the comments for you. But in the end, you don’t need to
understand every line of it. ;-) Suffice it to say it won’t syphon off your
data to me.


> What does it try to do in simple terms?  Or, how would I use it may be a
> better question? 

Look at my mail from 23.10., it has a textual description (the one with the
file tree): it basically wraps the old script over all files.

You have a directory 'A' with videos and a subdirectory 'A/temp' with new
videos. Start the script in A and it will go through all files in A/temp and
ask you what to do with each – skip (do nothing), keep (move to A without
renaming), or overwrite a certain file in A (keeping the extension), which is
the same as the old script.

> I been using the other script and it is coming in very handy.  It saves
> me quite a bit of time. 

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

When I’m old I’ll do nothing but complain. That’ll be a blast.
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> Am Wed, Nov 23, 2022 at 05:54:30AM -0600 schrieb Dale:
>> Frank Steinmetzger wrote:
>>> There ya goo. As I suspected, I already wrote most of it in October right
>>> away, I only couldn?t find the file until now. I just had to fix the same
>>> bugs as in the first script (and some more in the additional parts :D ),
>>> and put some more grease into the interal logic and output strings.
>>>
>> I saved it and then tried to figure it out.  I got lost.  I see the
>> commented sections which kinda help I guess but still got lost. 
> I was kinda verbose on the comments for you. But in the end, you don’t need to
> understand every line of it. ;-) Suffice it to say it won’t syphon off your
> data to me.
>
>
>> What does it try to do in simple terms?  Or, how would I use it may be a
>> better question? 
> Look at my mail from 23.10., it has a textual description (the one with the
> file tree): it basically wraps the old script over all files.
>
> You have a directory 'A' with videos and a subdirectory 'A/temp' with new
> videos. Start the script in A and it will go through all files in A/temp and
> ask you what to do with each – skip (do nothing), keep (move to A without
> renaming), or overwrite a certain file in A (keeping the extension), which is
> the same as the old script.
>
>> I been using the other script and it is coming in very handy.  It saves
>> me quite a bit of time. 

OK.  I think I get it.  It's kinda like dispatch-conf except it is for
files not lines in a file.  No 'merge' option tho. Kinda hard to merge a
video.  lol 

I may try that sometime.  I may copy the files to a different location
just in case I screw up something.  It won't be the real files so no
harm if I botch it.  This is mostly because I haven't seen it run
before.  I don't know what I'm doing.  ;-) 

Since I usually name the directory torrent, I may edit that part.  That
or change the name on my directories to temp. 

If you have other scripts, I'd like to see them.  Others might too. 
Someone may google for a way to do something and run up on them too. 

Dale

:-)  :-) 

P. S.  Now I'm trying to figure out how to change the resolution of all
videos in a directory.  Usually going from 1080p to 720p.  If you have a
script for that, awesome.  I'm currently using handbrake and it works
but there may be a better way. 
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Am Wed, Nov 23, 2022 at 06:16:12AM -0600 schrieb Dale:

> >> What does it try to do in simple terms?  Or, how would I use it may be a
> >> better question? 
> > Look at my mail from 23.10., it has a textual description (the one with the
> > file tree): it basically wraps the old script over all files.
> >
> > You have a directory 'A' with videos and a subdirectory 'A/temp' with new
> > videos. Start the script in A and it will go through all files in A/temp and
> > ask you what to do with each – skip (do nothing), keep (move to A without
> > renaming), or overwrite a certain file in A (keeping the extension), which is
> > the same as the old script.
>
> OK.  I think I get it.  It's kinda like dispatch-conf except it is for
> files not lines in a file.  No 'merge' option tho. Kinda hard to merge a
> video.  lol 
>
> I may try that sometime.  I may copy the files to a different location
> just in case I screw up something. It won't be the real files so no harm
> if I botch it.

Always have a backup. ;-)
I deny any responsibility for data loss. :-P

If you want to try it before doing real stuff: you could comment the two
lines where it says 'mv -f' and 'rm -f'. Then it won’t do anything, but
there are still progress messages being printed.

> P. S.  Now I'm trying to figure out how to change the resolution of all
> videos in a directory.  Usually going from 1080p to 720p.  If you have a
> script for that, awesome.

I use ffmpeg for all my encoding stuff, and have been using wrapper scripts
for years now to make things easier. However, none of them has resized yet.
It’s not difficult to configure, but the wrapper needs much more logic. As
in: find out the current resolution, see if it is actually larger, then
calculate the new resolution while keeping the aspect intact and so on.

> I'm currently using handbrake and it works but there may be a better way. 

I know handbrake by name, have been aware of it for many a year, but never
used it. In my Windows days I used VirtualDub for my editing stuff, and on
Linux I’ve always used commandline tools, beginning with mencoder back in
the day.

--
Grüße | Greetings | Salut | Qapla’
Please do not share anything from, with or about me on any social network.

I don’t mind dreaming in a foreign language.
What bugs me are the subtitles!
Re: Dolphin and adding a option, if it exists. [ In reply to ]
Frank Steinmetzger wrote:
> Am Wed, Nov 23, 2022 at 06:16:12AM -0600 schrieb Dale:
>
>>>> What does it try to do in simple terms?  Or, how would I use it may be a
>>>> better question? 
>>> Look at my mail from 23.10., it has a textual description (the one with the
>>> file tree): it basically wraps the old script over all files.
>>>
>>> You have a directory 'A' with videos and a subdirectory 'A/temp' with new
>>> videos. Start the script in A and it will go through all files in A/temp and
>>> ask you what to do with each – skip (do nothing), keep (move to A without
>>> renaming), or overwrite a certain file in A (keeping the extension), which is
>>> the same as the old script.
>> OK.  I think I get it.  It's kinda like dispatch-conf except it is for
>> files not lines in a file.  No 'merge' option tho. Kinda hard to merge a
>> video.  lol 
>>
>> I may try that sometime.  I may copy the files to a different location
>> just in case I screw up something. It won't be the real files so no harm
>> if I botch it.
> Always have a backup. ;-)
> I deny any responsibility for data loss. :-P
>
> If you want to try it before doing real stuff: you could comment the two
> lines where it says 'mv -f' and 'rm -f'. Then it won’t do anything, but
> there are still progress messages being printed.

I update my backups every week.  I'm going to order another hard drive
in a couple weeks.  I'm looking at a 16TB.  I've got to build a rig so I
can use LVM on two drives.  That 16TB won't last long with this new
fiber internet.  I still wish I could back up a large directory and
split it into two parts.  Have one part be directories starting with A
through L and second one start with M and go through to Z.  That would
roughly split it into two pieces.  Then I could use two drives for that
directory.  I use rsync but don't know of a way to split it. 

My biggest concern, I may do the wrong thing and mess up something.  I
have some videos that are hard to find. 


>> P. S.  Now I'm trying to figure out how to change the resolution of all
>> videos in a directory.  Usually going from 1080p to 720p.  If you have a
>> script for that, awesome.
> I use ffmpeg for all my encoding stuff, and have been using wrapper scripts
> for years now to make things easier. However, none of them has resized yet.
> It’s not difficult to configure, but the wrapper needs much more logic. As
> in: find out the current resolution, see if it is actually larger, then
> calculate the new resolution while keeping the aspect intact and so on.
>

I found commands for it but not a way to process lots of videos.  Right
now, I use the queue feature of handbrake.  I set up a preset to make it
the same each time.  I set it to 720p and about 3MB data rate.  Should
be OK for my 32" TV. 


>> I'm currently using handbrake and it works but there may be a better way. 
> I know handbrake by name, have been aware of it for many a year, but never
> used it. In my Windows days I used VirtualDub for my editing stuff, and on
> Linux I’ve always used commandline tools, beginning with mencoder back in
> the day.
>

I tried Kdenlive but couldn't figure it out.  It may work better but if
I can't figure it out, it isn't much help.  lol 

Dale

:-)  :-) 
Re: Dolphin and adding a option, if it exists. [ In reply to ]
On Wednesday, 23 November 2022 18:17:53 GMT Dale wrote:
> Frank Steinmetzger wrote:
> > Am Wed, Nov 23, 2022 at 06:16:12AM -0600 schrieb Dale:

> >> P. S. Now I'm trying to figure out how to change the resolution of all
> >> videos in a directory. Usually going from 1080p to 720p. If you have a
> >> script for that, awesome.
> >
> > I use ffmpeg for all my encoding stuff, and have been using wrapper
> > scripts
> > for years now to make things easier. However, none of them has resized
> > yet.
> > It’s not difficult to configure, but the wrapper needs much more logic. As
> > in: find out the current resolution, see if it is actually larger, then
> > calculate the new resolution while keeping the aspect intact and so on.
>
> I found commands for it but not a way to process lots of videos. Right
> now, I use the queue feature of handbrake. I set up a preset to make it
> the same each time. I set it to 720p and about 3MB data rate. Should
> be OK for my 32" TV.

It depends how close you sit to the 32" screen. The closer you are the higher
the resolution needed to avoid seeing individual pixels. If the size of the
file is not important, I'd leave it at 1080p. You never know, you may obtain
a bigger TV in the future.

With ffmpeg you can use its scale filter to retain the same aspect ratio, but
reduce the height:

ffmpeg -i blah-1080.mp4 -vf scale=-1:720 -codec:v libx264 -crf 0 -codec:a aac
blah-720.mp4

NOTES:

1. Run ffprobe to see what the original video codecs are and use an
appropriate video/audio codec to suit your desired output. The video will
have to be transcoded to a lower resolution, but the audio can be just copied
over.

2. The -crf controls the quality of the quantizer - default is 23. I've set
it at 0 to make it lossless, but this takes longer to process. You could
instead use some tuning preset provided in the H.264 encoding guide linked to
below:

https://ffmpeg.org/ffmpeg-filters.html#scale

https://trac.ffmpeg.org/wiki/Scaling

http://trac.ffmpeg.org/wiki/Encode/H.264


Once you find your desired stanza to arrive at some optimal size-quality-
processing time, you can modify Frank's script to resize and rename your
videos.

1 2  View All