From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B8EDE158020 for ; Sun, 23 Oct 2022 11:58:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88940E0950; Sun, 23 Oct 2022 11:58:10 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A0425E0940 for ; Sun, 23 Oct 2022 11:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666526281; bh=GShcmFIv5gIQlpz0Rxb0oMdnWNXJaOIH8FCMsLC9N94=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=Uq8cAXsgKM43GW5QPjkZQd3snLkVoJKlNIMsJY7E5D4cCls009p4H/+kE2zn9Tqp6 +/N2wrGzH8mr3wkF83uN34e/1eJIJ54yF+93xEB+lYpYqb3VqE2Aqnlvz7eBVsnV2P 7AupJTplSVA6D4iE3q+ZbLslqZsh2yXLEFJh1/U4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from kern ([92.117.58.116]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mzhj9-1oziqu027N-00vj1H for ; Sun, 23 Oct 2022 13:58:01 +0200 Date: Sun, 23 Oct 2022 13:57:59 +0200 From: Frank Steinmetzger To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Dolphin and adding a option, if it exists. Message-ID: Mail-Followup-To: gentoo-user@lists.gentoo.org References: <6ef36d93-4d8a-d9a4-ca71-396040103a25@gmail.com> <20221006134500.6f0812b9@digimed.co.uk> <62ebaa87-f750-b233-f8b4-ee50ef00bdfa@gmail.com> <84e13f7d-f4c9-f86c-3e16-c36df1ea9f35@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FiwyiXUWiFYIlfjy" Content-Disposition: inline In-Reply-To: <84e13f7d-f4c9-f86c-3e16-c36df1ea9f35@gmail.com> User-Agent: Mutt 2.2.7; VIM - Vi IMproved 9.0 X-Provags-ID: V03:K1:VSxORFuA51LKEi8NNgJbiyk4lsyisUgof14uBYb9/jxMOGcZaV+ ntboxGzErlsrvIbLfgCMQQuq6j3KHZ5PTE7S94ST4JZdHqvK3/V7igsOj0lYhZCeaInAV7c ZB5I5gDEUIozIKiYdzp3jMWLfRXqBBrATwjVIJqozhGQcb/8Pd7x50ALQIZrVcjVkeODS1S BGir8PLIc5feoWhA+pxmw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zFHNvkQyaQs=:UcxtuWBZ6BDsXynp2nv4lP H9HCZw4pM0LDzkRdH96nz7X8Cjh+2M7hEjQfGd9aXiaOBVSuyhspWF+rj/MF9kTss7kJQBpYs 2VAQEgkewizAFbceOIPs2shRT9puVUxKbLFVqYbtedbdKEpLyf4bfQGIk3LMRhcZAYoyXIdtD gk9oMf/VcFP26cUXNJ34zOTnNCJ7Iv+okSt7i7FcT4GvqbJ4+kba3hvYC2ZJVHuQY+Oh7htB7 1lq74/UTqy0go5P9nynRGB4SmaSAcJOGaIvR1OxQt94Ungsd1uhTV4yL2SSIQno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qdWvvzadmcSW6Ub39Qurm8YEKdpF+c8mcBpGvdX n4jvdvJhZIblKsagKvh/xxlr3tva8joxrWmDyBscwNiY3+GKqDGt4aMt0a3uTs5CdgiRHAcgp qQCcTEtdJ3GvPWO2yhecCyLH50XfIU8DI1uZnCT2tXBjG8A19zsT3FaYZjJzm+OVAeYbjtGOs g6IOSGqbIIWpGapULLVLxQz0eLYLcx1qYn8rLrFuZzxOY X-Archives-Salt: a99c6551-d163-4889-b816-3a23902882f3 X-Archives-Hash: d570756703523eabab565f360bf4fd19 --FiwyiXUWiFYIlfjy Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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.=C2=A0 This isn't much of a problem = with > >> Linux but I'm not sure how this would work on windoze tho.=C2=A0 The p= roblem, > >> if it is one, is the file extension.=C2=A0 Let's say I have a mp4 file= that > >> is the older original file that I intend to replace.=C2=A0 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.=C2=A0 So, I end up with a .mkv file that has a .mp4 exten= sion.=C2=A0 > >> It works here on Linux but not sure about windoze and such. > > It=E2=80=99s 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=E2=80=99s mp4 and can handle it. >=20 > That is true on Linux.=C2=A0 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=E2=84=A2, too. > Heck, you could likely change a > .mp4 to .txt and it would open with a video player just by clicking on > it.=C2=A0 Thing is, if I share a file with someone who uses windoze, I'm = not > sure if it would work the same way.=C2=A0 A wrong extension could cause > problems, either not opening at all or crashing something.=C2=A0 It's > windoze, one can't expect much.=C2=A0 ROFL=C2=A0 Now you=E2=80=99re talking about double-clicking in a file manager and open= the registered application. That=E2=80=99s the same=E2=80=94to some extent=E2= =80=94on 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.=C2=A0 Thing is, I couldn't write a fancy script if my life depended = on > it.=C2=A0 I also looked into using Krename to do it but it refuses to cha= nge > a extension.=C2=A0 Doing it one file at a time manually puts me back to w= here > it is easier to change the file the old way.=C2=A0 Time consuming but wor= ks.=C2=A0 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.=C2=A0 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=E2=80=99s base part with the source=E2=80=99s extensio= n part. > =C2=A0 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=3D~/usr/bin:$PATH. Actual= ly, 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.=C2=A0 Same as= mv > maybe?=C2=A0 Yes. You give it two arguments. That=E2=80=99s what $1 and $2 are for in th= e 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.= =C2=A0 That=E2=80=99s the proper way to do it. I also have a root console open all= the time, but don=E2=80=99t 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.=C2=A0 I have a set= of > videos that go together.=C2=A0 When I have a new version of one or more v= ideos, > I place them in a sub-directory until they are named properly or something > so I can move to the main directory.=C2=A0 Like this: >=20 > Main Directory=C2=A0 #Permanent location for files ----- Sub-directory=C2= =A0 > #Temporary location for files needing names changed etc.=C2=A0 Once done,= they > move up to main directory. I don=E2=80=99t 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. >=20 > mv sub-directory/ 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=E2=80=99t 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=E2=80=99s assume we have the following file tree: main =E2=94=9C=E2=94=80=E2=94=80 episode 1.mkv =E2=94=9C=E2=94=80=E2=94=80 episode 2.mpeg =E2=94=9C=E2=94=80=E2=94=80 episode 3.avi =E2=94=94=E2=94=80=E2=94=80 temp =E2=94=94=E2=94=80=E2=94=80 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.=C2=A0 ;-)=C2=A0 = I've said > this before, my scripting skills are so small it isn't funny.=C2=A0 :/ 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. --=20 Gr=C3=BC=C3=9Fe | Greetings | Salut | Qapla=E2=80=99 Please do not share anything from, with or about me on any social network. Of all the people I=E2=80=99ve met you=E2=80=99re certainly one of them. --FiwyiXUWiFYIlfjy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEVbE9o2D2lE5fhoVsizG+tUDUMMoFAmNVLEUACgkQizG+tUDU MMp9AA/+Jg/VVm6+VBNRELe3nQF4RDKIhaTtfNcmdjE0u4eFnBh0io0TNG4nzBNb GaDgVwdkNZM4xsfBQUejxifEJgBAnXzuLvWF72gJJkBRs4v8bLolHP3CLalUB63y GdCJ+8XDxBGSSFeWAuea4Mx+sZKFwzsrO30nqAOxrvuFoZY4XgTPifO4V9gBrA46 P3VjWiBpPJbxBW3hs7Xnvnyevq1xZh/YP5hj9tQ+LgzNllyxhVn0fMByYLbl8zVT +KPpHQU9o3H8nTIXm205xOefq5O+XF3v8noCkQa9wfowa+fEg3+nL5hLr6GMFjOE ADUEOQNra2scXagja+Yd/lK3gv76P+d0L5JuxZTq9iFsFqG/APDHDzHwI4McTbza 2QO3I3wcNbAKjnm8UbJ1omko3HB69WvyJ3k1qAe6hN66QYenQ8f1kzvqCkD8GqI+ ZdW91ym2nfxxAxO9BE+wMl0X1OdRePqqPI2kW7/t7QOuy/eoja6KpPnCew1W1B9B a9D9DJq5PzusvZnDN6NZ0nmWxdmkgh6Yh5Gba9jCyOOTZLogGPLRucL3U8R3Ihjg AXnR5/EVLlPmeM8pJ0jqrFRrGZ5CH53qES9WqBCK+7SQY6zqBQshDsiT5RUTet7Z 1jtgnR6XmnaFVsbUBK2DLqWxSLjkyKV70p+2hqkpk9zDaNyICkA= =wLJf -----END PGP SIGNATURE----- --FiwyiXUWiFYIlfjy--