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
62613ae3
Commit
62613ae3
authored
3 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
read files' tags
parent
d7b5f7be
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
README.md
+5
-0
5 additions, 0 deletions
README.md
good_ol_mixtape.py
+28
-3
28 additions, 3 deletions
good_ol_mixtape.py
with
33 additions
and
3 deletions
README.md
+
5
−
0
View file @
62613ae3
...
...
@@ -3,6 +3,11 @@
A little python project to create old school mix-CDs out of an m3u playlist
## Dependencies
*
m3u8
*
music-tag
*
urllib.parse
## Install
```
bash
pip
install
m3u8
pip
install
music-tag
```
This diff is collapsed.
Click to expand it.
good_ol_mixtape.py
+
28
−
3
View file @
62613ae3
...
...
@@ -2,10 +2,35 @@
# -*- coding: UTF-8 -*-
# created by lzbk
import
m3u8
import
music_tag
from
urllib.parse
import
unquote
class
Song
:
def
__init__
(
self
,
song_path
):
self
.
file
=
music_tag
.
load_file
(
song_path
)
def
__str__
(
self
):
return
str
(
self
.
file
[
'
title
'
])
class
MixTape
:
def
__init__
(
self
,
pl
):
self
.
playlist
=
m3u8
.
load
(
pl
)
@classmethod
def
uri2path
(
cls
,
uri
):
res
=
uri
.
replace
(
"
file://
"
,
""
)
if
res
==
uri
:
raise
ValueError
(
uri
+
"
is not a file uri.
"
)
else
:
return
unquote
(
res
)
def
__init__
(
self
,
pl_path
):
self
.
playlist
=
[]
for
s
in
m3u8
.
load
(
pl_path
).
segments
:
try
:
self
.
playlist
.
append
(
Song
(
MixTape
.
uri2path
(
s
.
uri
)))
except
ValueError
as
e
:
print
(
e
)
def
__str__
(
self
):
return
str
(
self
.
playlist
.
segments
)
+
"
\n
"
+
str
(
self
.
playlist
.
target_duration
)
res
=
""
for
track
in
self
.
playlist
:
res
+=
track
.
__str__
()
+
"
\n
"
return
res
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