Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Old school mix-tape or cd project
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Loiseau
Old school mix-tape or cd project
Commits
d2682c31
Commit
d2682c31
authored
3 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
read and modify tags
parent
62613ae3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
g_ol_m.py
+2
-1
2 additions, 1 deletion
g_ol_m.py
good_ol_mixtape.py
+26
-5
26 additions, 5 deletions
good_ol_mixtape.py
with
28 additions
and
6 deletions
g_ol_m.py
+
2
−
1
View file @
d2682c31
...
@@ -6,8 +6,9 @@ import argparse
...
@@ -6,8 +6,9 @@ import argparse
from
good_ol_mixtape
import
MixTape
from
good_ol_mixtape
import
MixTape
parser
=
argparse
.
ArgumentParser
(
description
=
"
Créer une mix-tape
"
)
parser
=
argparse
.
ArgumentParser
(
description
=
"
Créer une mix-tape
"
)
parser
.
add_argument
(
"
-p
"
,
"
--playlist
"
,
help
=
"
le fichier .m3u8 de la playlist
"
,
type
=
str
)
parser
.
add_argument
(
"
-p
"
,
"
--playlist
"
,
help
=
"
le fichier .m3u8 de la playlist
"
,
type
=
str
)
parser
.
add_argument
(
"
-t
"
,
"
--mix_title
"
,
help
=
"
le titre du mix
"
,
type
=
str
,
default
=
None
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
mx
=
MixTape
(
args
.
playlist
)
mx
=
MixTape
(
args
.
playlist
,
args
.
mix_title
)
print
(
mx
)
print
(
mx
)
This diff is collapsed.
Click to expand it.
good_ol_mixtape.py
+
26
−
5
View file @
d2682c31
...
@@ -6,11 +6,26 @@ import music_tag
...
@@ -6,11 +6,26 @@ import music_tag
from
urllib.parse
import
unquote
from
urllib.parse
import
unquote
class
Song
:
class
Song
:
def
__init__
(
self
,
song_path
):
def
__init__
(
self
,
song_path
,
mixAlbum
=
None
,
mixNumber
=
None
):
self
.
file
=
music_tag
.
load_file
(
song_path
)
self
.
track
=
music_tag
.
load_file
(
song_path
)
self
.
title
=
self
.
track
[
'
title
'
].
first
self
.
o_album
=
self
.
track
[
'
album
'
].
first
self
.
artist
=
self
.
track
[
'
artist
'
].
first
self
.
o_number
=
self
.
track
[
'
tracknumber
'
].
first
self
.
o_year
=
self
.
track
[
'
year
'
].
first
if
mixAlbum
!=
None
:
self
.
set_mixTitle
(
mixAlbum
)
if
mixNumber
!=
None
:
self
.
set_numInMix
(
mixNumber
)
def
set_mixTitle
(
self
,
mixAlbum
):
self
.
track
[
'
album
'
]
=
mixAlbum
def
set_numInMix
(
self
,
mixNumber
):
self
.
track
[
'
tracknumber
'
]
=
mixNumber
def
__str__
(
self
):
def
__str__
(
self
):
return
str
(
self
.
file
[
'
title
'
])
return
f
"
{
self
.
track
[
'
tracknumber
'
].
first
}
.
{
self
.
track
[
'
album
'
].
first
}
/
{
self
.
title
}
—
{
self
.
artist
}
(track #
{
self
.
o_number
}
of
{
self
.
o_album
}
)
"
class
MixTape
:
class
MixTape
:
@classmethod
@classmethod
...
@@ -21,11 +36,17 @@ class MixTape:
...
@@ -21,11 +36,17 @@ class MixTape:
else
:
else
:
return
unquote
(
res
)
return
unquote
(
res
)
def
__init__
(
self
,
pl_path
):
def
__init__
(
self
,
pl_path
,
title
=
None
):
self
.
playlist
=
[]
self
.
playlist
=
[]
self
.
title
=
title
num
=
1
for
s
in
m3u8
.
load
(
pl_path
).
segments
:
for
s
in
m3u8
.
load
(
pl_path
).
segments
:
try
:
try
:
self
.
playlist
.
append
(
Song
(
MixTape
.
uri2path
(
s
.
uri
)))
if
self
.
title
==
None
:
self
.
playlist
.
append
(
Song
(
MixTape
.
uri2path
(
s
.
uri
)))
else
:
self
.
playlist
.
append
(
Song
(
MixTape
.
uri2path
(
s
.
uri
),
self
.
title
,
num
))
num
+=
1
except
ValueError
as
e
:
except
ValueError
as
e
:
print
(
e
)
print
(
e
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment