Is it necessary to define runtime/"run time" in m3u playlist file or is there a way around it? - m3u

E.g. in the m3u file below, the running times are listed as 419, 260 and 255.
#EXTM3U
#EXTINF:419,Alice In Chains - Rotten Apple
Alice In Chains_Jar Of Flies_01_Rotten Apple.mp3
#EXTINF:260,Alice In Chains - Nutshell
Alice In Chains_Jar Of Flies_02_Nutshell.mp3
#EXTINF:255,Alice In Chains - I Stay Away
Is it possible to write an m3u file without these properties?
Or just include some kind of default?
Are there repercussions?

There is no standard for m3u. The time is optional. You can enter just "1" for time if you want. Furthermore, the entire line is optional:
#EXTINF:419,Alice In Chains - Rotten Apple
Alice In Chains_Jar Of Flies_01_Rotten Apple.mp3
Could be replaced with:
Alice In Chains_Jar Of Flies_01_Rotten Apple.mp3
The #EXTINF: tag is for the extended format. As a matter of fact it is not even understood by some players and will cause the entire playlist to appear as empty.

I think this depends a lot on what is going to read the playlist.
The most basic m3u file just contains the list of files (or URLs) without any of the '#' lines. In this format the player will have to read the files if it wants to know their duration. This could be slow especially for URLs.

Related

Rename files sequentially keeping "connected" file names pattern using regular expressions

I'm trying to reorganize photo library that contains edited files as well as originals. I already achieved desired folder structure using Exif Sorter, i.e %UserProfile%\Photos\%year%\%month%\%day%.
Each %day% folder contains photo image files with a little bit different name pattern:
IMG_0001.jpg
ZMGM00002.jpg
ZMGM00003 (Edited).jpg
ZMGM00003.jpg
IMG_0002 (Edited).jpg
IMG_0002.jpg
IMG_0004.jpg
I'd like files to be named sequentially but keeping relevant " (Edited)" suffix:
DSC_0001.jpg
DSC_0002.jpg
DSC_0002 (Edited).jpg
DSC_0003.jpg
DSC_0004 (Edited).jpg
DSC_0004.jpg
DSC_0005.jpg
So far I came up with regular expression to rename "*.jpg" and "* (Edited).jpg" preserving it's "suffix" part when it's there (" (Edited)") (sorry I use RegexRenamer because I'm beginner):
match string ^(\D+)(_)?(\d+)(Edited)?
replace string DCS_$#$4
However I get sequential numbering across all files and thus the relevance of edited files is lost:
DSC_0001.jpg
DSC_0002.jpg
DSC_0003 (Edited).jpg
DSC_0004.jpg
DSC_0005 (Edited).jpg
DSC_0006.jpg
DSC_0007.jpg
Is there any way I can rename files and preserve filename "connection" pattern between them, i.e. so I get DSC_0002 (Edited).jpg & DSC_0002.jpg instead of DSC_0002 (Edited).jpg & DSC_0003.jpg?
Since I've got thousands of folders, the renaming should be recourse & sequence should restarted with each new folder. I believe this requires PowerShell or batch scripting that will determine required condition but I'm not sure where to start. I am open to ideas like maybe I could process file names via Excel first and then batch-rename from TXT/CSV file.
P.S. I've got like 80000 family photos since late 90's, it would take ages to process by hand. I can run anything in Windows and macOS to solve this (would prefer Windows though).

can you use regex within a MS Word link to a file?

Is it possible to incorporate regex into a MS Word code link to other files?
I am tasked with delivering a daily report with images which are always saved at the same directories, but whose names may change slightly depending on the day. These file names may contain "KPIR" or "KPIE" depending on how they are generated, and "48h" or "72h" depending on which day of the week they were generated.
My current report features links in this form:
{ INCLUDEPICTURE Z:\\Daily_Reports\\Inputs\\KPI\\KPIR_48h_combined_world.png \* MERGEFORMAT }
But when the names change, I must manually change all the links in the word file and revert this the following day, hence my interest in using regex within the code link.
Some other threads hint that regex should be possible in MS Word, e.g. RegEx does not work in MS Word. Thus, I tried to replace KPIR in that link by KPI[A-Z] , KPI[E,R] , KPI? and also KPI* but none of them worked; and similarly for the 48h vs 72h, I tried [0-9][0-9]h , *h , ??h , (\")(\d{2})(\")h , and also (\d{2})h with no success.
Does anybody know the trick to this? Many thanks!
No, that is not possible. You can only link to an explicit filename. Instead of changing the links, you might consider setting up a process that renames the received images.

GAMS: Filename cannot be used as valid UEL

I trying to merge a large data set in gams. The file should consist of multiple gdx files with several names. The programme merges the files as I would like them to however: it replaces the names of the file to be merged with File_1, File_2, File_3 and so on. I would like to see the name of the gdx file in the merged file (and so far the script I wrote worked fine).
I'm receiving the following error for each line:
***Filename cannot be used as a valid UEL
Existing name: ImpactYesPGTNoLDViolation-D1-PG10-LDI-LDE0.001-LB0.0045-PDC0-D10
Replaced with File_1
Why does this happen? Could it be that the existing name is too long? I tried finding out more about this error but so far have not found any information on it. And is there anyway to fix it? I need the information of the existing name in order to further process the output.
You are right. This name is too long to be used as UEL (aka label). You can only use up to 63 characters. You can read more about this and other limitations for UELs here

How to edit text file data with c++

I have a program that create a text file of stock items, which contains detail of 'total production' , 'stock remaining' and so on. Now my question is how do I edit that text file with my program. For example if I mistake to enter a correct data (like production was 500 pieces but enter only 400) now how can I edit my file to make it correct without effecting other data.
You probably should not create a text file in the first place. Did you consider using sqlite (or indexed files à la GDBM ...) or some real database like PostgreSQL or MongoDb?
If you insist on editing programmatically a textual file, the only way is to process every line : either keep all of them in memory, or copy them (except the one you'll change) to some new file.... But there is no portable way to change the content of a file in the middle.
You might also be interested in textual serialization formats like JSON, YAML (or maybe even XML).

Is there anyway to rename the "Source" button to something like "HTML"?

Is there anyway to rename the "Source" button to something like "HTML", I ask this as users are confused at how to add html code using the editor?
Yes, inside of the "lang" folder you will see all of the various language files.
For my case, and probably yours, You will want to edit the file "en.js". The file is "compressed" to some degree so it may be difficult to read, but it's still not too difficult to change one string. If you do plan on changing multiple strings you will most likely want to use a service to format Javascript.
Search for the following segment of code. It was one of the very last lines in the file.
"sourcearea":{"toolbar":"Source"}
change it to
"sourcearea":{"toolbar":"HTML"}
Avoid This Method Unless Required
And as for a very unsuggested method, since you can't modify the language files for some reason, you can modify the ckeditor.js file and force a specific label.
Inside of "ckeditor.js" change the line below
a.ui.addButton("Source",{label:a.lang.sourcearea.toolbar,command:"source",toolbar:"mode,10"});
to the follow code
a.ui.addButton("Source",{label:"HTML",command:"source",toolbar:"mode,10"});
The only thing modified is the "label" value in the above line. We remove the reference to the a.language.sourcearea.toolbar and insert a string in it's place instead.