Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Citronalco
br-download
Commits
8c9025aa
Commit
8c9025aa
authored
Jun 19, 2018
by
citronalco
Browse files
use File::Spec instead of "/"
parent
8813b84a
Changes
1
Hide whitespace changes
Inline
Side-by-side
zuendfunk-download.pl
View file @
8c9025aa
...
...
@@ -8,6 +8,7 @@ use XML::LibXML;
use
JSON
;
use
MP3::
Tag
;
MP3::
Tag
->
config
(
write_v24
=>
1
);
use
File::
Spec
;
use
utf8
;
my
$DESTDIR
=
$ARGV
[
0
];
...
...
@@ -79,7 +80,8 @@ foreach (@{$decodedProgramJSON->{'channelBroadcasts'}}) {
my
$filename
=
"
Zündfunk
"
.
join
("
-
",
reverse
(
split
(
/\./
,
$longestAudio
{'
broadcastDate
'})))
.
"
-
"
.
substr
(
$longestAudio
{'
title
'},
0
,
80
)
.
"
.mp3
";
$filename
=~
s/[^\w\s\-\.]/_/g
;
if
(
-
f
$DESTDIR
.
"
/
"
.
$filename
)
{
my
$file
=
File::
Spec
->
join
(
$DESTDIR
,
$filename
);
if
(
-
f
$file
)
{
print
"
File
"
.
$filename
.
"
does already exist, skipping
\n
";
next
;
}
...
...
@@ -95,9 +97,9 @@ foreach (@{$decodedProgramJSON->{'channelBroadcasts'}}) {
}
);
while
(
$tries
)
{
open
(
$FD
,"
>>
"
.
$
DESTDIR
.
"
/
"
.
$filenam
e
.
"
.part
");
open
(
$FD
,"
>>
"
.
$
fil
e
.
"
.part
");
my
$bytes
=-
s $
DESTDIR."/".$filenam
e.".part";
my
$bytes
=-
s $
fil
e.".part";
if ($bytes > 0) {
push(@parameters,"Range"=>"bytes=".$
bytes
.
"
-
");
}
...
...
@@ -112,9 +114,9 @@ foreach (@{$decodedProgramJSON->{'channelBroadcasts'}}) {
next
;
}
rename
$
DESTDIR
.
"
/
"
.
$filename
.
"
.part
",
$DESTDIR
.
"
/
"
.
$filenam
e
;
rename
$
file
.
"
.part
",
$fil
e
;
my
$mp3file
=
MP3::
Tag
->
new
(
$
DESTDIR
.
"
/
"
.
$filenam
e
);
my
$mp3file
=
MP3::
Tag
->
new
(
$
fil
e
);
$mp3file
->
get_tags
();
my
$id3v2
=
(
$mp3file
->
{
ID3v2
}
or
$mp3file
->
new_tag
("
ID3v2
"));
$id3v2
->
artist
("
Zündfunk
");
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment