Mailing List Archive

mythlink.pl for 0.28
Greetings

I recall a while back using mythlink.pl to get readable filenames for TV
recordings I wanted to archive but this may have been on 0.26 or 0.27.

I'm about to do a total rebuild of my system and thought it a great time
to get rid of some of the cruft by just keeping a few TV recordings as
Video files. I can then rescan music & videos into a totally fresh system
and start the recording setup from scratch with new tuners.

Problem is all the versions of mythlink I have found fail with the same
error:
Can't find string terminator "EOF" anywhere before EOF at ./mythlink.pl
line 63.

Anyone an idea of what is going on or is there another way I can 'export'
the recordings as videos with meaningful names?

Thanks

--
Robin Gilks


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
On 05/02/2022 07:40 AM, Robin Gilks wrote:
> Greetings
>
> I recall a while back using mythlink.pl to get readable filenames for TV
> recordings I wanted to archive but this may have been on 0.26 or 0.27.
>
> I'm about to do a total rebuild of my system and thought it a great time
> to get rid of some of the cruft by just keeping a few TV recordings as
> Video files. I can then rescan music & videos into a totally fresh system
> and start the recording setup from scratch with new tuners.
>
> Problem is all the versions of mythlink I have found fail with the same
> error:
> Can't find string terminator "EOF" anywhere before EOF at ./mythlink.pl
> line 63.
>
> Anyone an idea of what is going on or is there another way I can 'export'
> the recordings as videos with meaningful names?
>

Check out the mythlink.pl script you're running. Somewhere around line
262 should be a line that contains only "EOF" and then a line feed.
Usually an error like this is caused when there's an errant space or
invisible character on the line.

https://github.com/MythTV/mythtv/blob/master/mythtv/contrib/user_jobs/mythlink.pl#L262

Alternatively, it's possible your copy of the script is actually
truncated. You can always download a new copy of mythlink.pl from

https://raw.githubusercontent.com/MythTV/mythtv/master/mythtv/contrib/user_jobs/mythlink.pl

and then "Save Page As" and give that a try.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
On Mon, 2 May 2022 23:40:31 +1200, you wrote:

>Greetings
>
>I recall a while back using mythlink.pl to get readable filenames for TV
>recordings I wanted to archive but this may have been on 0.26 or 0.27.
>
>I'm about to do a total rebuild of my system and thought it a great time
>to get rid of some of the cruft by just keeping a few TV recordings as
>Video files. I can then rescan music & videos into a totally fresh system
>and start the recording setup from scratch with new tuners.
>
>Problem is all the versions of mythlink I have found fail with the same
>error:
>Can't find string terminator "EOF" anywhere before EOF at ./mythlink.pl
>line 63.
>
>Anyone an idea of what is going on or is there another way I can 'export'
>the recordings as videos with meaningful names?
>
>Thanks

My version of mythlink.pl is a little different (v32), but it looks
like that message is caused by it trying to display the usage message.
That is done by printing from the file all the text after the print
line until it comes to a line with the three characters EOF at the
start of the line. But the print command in never finding the EOF
characters before it reads the end of the file (=EOF). So two
completely different meanings for EOF here confusing things. Your
copy of mythlink.pl seems to be corrupt. What it should look like is
this at around line 63:

# Print usage
if ($usage) {
print <<EOF;
$0 usage:

options:


and then lots more usage text until this:

--help
--usage

Show this help text.

EOF
exit;
}

# Ensure --chanid and --starttime were specified together, if at all
if ((defined($chanid) or defined($starttime)) and
!(defined($chanid) and defined($starttime))) {
die "The arguments --chanid and --starttime must be used
together.\n";
}

The EOF marker characters there just above the "exit;" command seem to
be missing, or do not starting in column 1. Or possibly the line
endings are wrong, so that it is not finding the end of the line prior
to the EOF characters properly. The line endings should be a single
LF character, not CRLF. I am not sure if the EOF characters need to
be the only thing on that line, but check that there are no extra
characters between them and the end of that line.

The mythlink.pl file comes from the mythtv-backend package, so you
could try downloading a copy of the mythtv-backend deb file and
unpacking it somewhere and getting a new copy of mythlink.pl from it.

https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/

Then you can compare them and see what is different.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
> On Mon, 2 May 2022 23:40:31 +1200, you wrote:
>
>>Greetings
>>
>>I recall a while back using mythlink.pl to get readable filenames for TV
>>recordings I wanted to archive but this may have been on 0.26 or 0.27.
>>
>>I'm about to do a total rebuild of my system and thought it a great time
>>to get rid of some of the cruft by just keeping a few TV recordings as
>>Video files. I can then rescan music & videos into a totally fresh system
>>and start the recording setup from scratch with new tuners.
>>
>>Problem is all the versions of mythlink I have found fail with the same
>>error:
>>Can't find string terminator "EOF" anywhere before EOF at ./mythlink.pl
>>line 63.
>>
>>Anyone an idea of what is going on or is there another way I can 'export'
>>the recordings as videos with meaningful names?
>>
>>Thanks
>
> My version of mythlink.pl is a little different (v32), but it looks
> like that message is caused by it trying to display the usage message.
> That is done by printing from the file all the text after the print
> line until it comes to a line with the three characters EOF at the
> start of the line. But the print command in never finding the EOF
> characters before it reads the end of the file (=EOF). So two
> completely different meanings for EOF here confusing things. Your
> copy of mythlink.pl seems to be corrupt. What it should look like is
> this at around line 63:
>
> # Print usage
> if ($usage) {
> print <<EOF;
> $0 usage:
>
> options:
>
>
> and then lots more usage text until this:
>
> --help
> --usage
>
> Show this help text.
>
> EOF
> exit;
> }
>
> # Ensure --chanid and --starttime were specified together, if at all
> if ((defined($chanid) or defined($starttime)) and
> !(defined($chanid) and defined($starttime))) {
> die "The arguments --chanid and --starttime must be used
> together.\n";
> }
>
> The EOF marker characters there just above the "exit;" command seem to
> be missing, or do not starting in column 1. Or possibly the line
> endings are wrong, so that it is not finding the end of the line prior
> to the EOF characters properly. The line endings should be a single
> LF character, not CRLF. I am not sure if the EOF characters need to
> be the only thing on that line, but check that there are no extra
> characters between them and the end of that line.
>
> The mythlink.pl file comes from the mythtv-backend package, so you
> could try downloading a copy of the mythtv-backend deb file and
> unpacking it somewhere and getting a new copy of mythlink.pl from it.
>
> https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/

Making progress - seems like the perl file had trailing spaces where it
shouldn't!! No idea how that came about...

Next problem is that the show title needs to be quoted somehow if it has
embedded spaces:
mkdir /mnt/backups/links/1 News At 6pm: Permission denied at ./mythlink.pl
line 493.
Here is the code snippet where the problem occurs:
# Create the link
my $directory = dirname("$dest/$name");
unless (-e $directory) {
mkpath($directory, 0, 0775)
or die "Failed to create $directory: $!\n";
}
symlink $show->{'local_path'}, "$dest/$name"
or die "Can't create symlink $dest/$name: $!\n";
vprint("$dest/$name");

I haven't done anything with perl for over 25 years - forgotten how to
drive it!

--
Robin Gilks


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
> ...is there another way I can 'export' the recordings as videos with meaningful names?

MythArchive can copy the recordings and create a folder with a meaningful name for each exported file.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
On Tue, 3 May 2022 11:11:50 +1200, you wrote:

>Making progress - seems like the perl file had trailing spaces where it
>shouldn't!! No idea how that came about...
>
>Next problem is that the show title needs to be quoted somehow if it has
>embedded spaces:
>mkdir /mnt/backups/links/1 News At 6pm: Permission denied at ./mythlink.pl
>line 493.
>Here is the code snippet where the problem occurs:
> # Create the link
> my $directory = dirname("$dest/$name");
> unless (-e $directory) {
> mkpath($directory, 0, 0775)
> or die "Failed to create $directory: $!\n";
> }
> symlink $show->{'local_path'}, "$dest/$name"
> or die "Can't create symlink $dest/$name: $!\n";
> vprint("$dest/$name");
>
>I haven't done anything with perl for over 25 years - forgotten how to
>drive it!

I just ran mythlink.pl on my test machine and it runs fine - there are
no problems with file names with spaces in them. So your permissions
problem is likely from the directory where it is attempting to store
the links. The message is mentioning "1 News At 6pm" only because
that is the first link it was trying to create. So you might like to
try using it like this:

mkdir /tmp/mythlink
chmod a=rwx /tmp/mythlink
/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --verbose
--path /tmp/mythlink

The last command of the 3 is all on one line - my email client wraps
longer lines.

Or you could just run it as root.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythlink.pl for 0.28 [ In reply to ]
> On Tue, 3 May 2022 11:11:50 +1200, you wrote:
>
>>Making progress - seems like the perl file had trailing spaces where it
>>shouldn't!! No idea how that came about...
>>
>>Next problem is that the show title needs to be quoted somehow if it has
>>embedded spaces:
>>mkdir /mnt/backups/links/1 News At 6pm: Permission denied at
>> ./mythlink.pl
>>line 493.
>>Here is the code snippet where the problem occurs:
>> # Create the link
>> my $directory = dirname("$dest/$name");
>> unless (-e $directory) {
>> mkpath($directory, 0, 0775)
>> or die "Failed to create $directory: $!\n";
>> }
>> symlink $show->{'local_path'}, "$dest/$name"
>> or die "Can't create symlink $dest/$name: $!\n";
>> vprint("$dest/$name");
>>
>>I haven't done anything with perl for over 25 years - forgotten how to
>>drive it!
>
> I just ran mythlink.pl on my test machine and it runs fine - there are
> no problems with file names with spaces in them. So your permissions
> problem is likely from the directory where it is attempting to store
> the links. The message is mentioning "1 News At 6pm" only because
> that is the first link it was trying to create. So you might like to
> try using it like this:
>
> mkdir /tmp/mythlink
> chmod a=rwx /tmp/mythlink
> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --verbose
> --path /tmp/mythlink
>
> The last command of the 3 is all on one line - my email client wraps
> longer lines.
>
> Or you could just run it as root.

Well spotted - that is exactly what the issue was. Thanks Stephen

--
Robin Gilks


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org