Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2015104194
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
GyuhoLee
2021-05-25 19:14:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
420d08167daa66b46c904dc46dac053882ca5d64
420d0816
1 parent
bbe1ef95
[Add] song info class
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
src/song.py
src/song.py
0 → 100644
View file @
420d081
import
requests
,
re
from
io
import
BytesIO
from
PIL
import
Image
import
numpy
as
np
class
Song
:
def
__init__
(
self
):
self
.
year
=
0
self
.
month
=
0
self
.
rank
=
0
self
.
title
=
''
self
.
singer
=
''
self
.
album
=
''
self
.
genre
=
''
self
.
date
=
''
self
.
likes
=
0
self
.
lyrics
=
''
self
.
keywords
=
[]
def
setImage
(
self
,
url
):
res
=
requests
.
get
(
url
)
self
.
img
=
Image
.
open
(
BytesIO
(
res
.
content
))
def
getRow
(
self
):
self
.
title
.
strip
()
self
.
album
=
re
.
sub
(
r"[?'/\"*<>:]"
,
""
,
self
.
album
)
try
:
return
[
self
.
year
,
self
.
month
,
self
.
rank
,
self
.
title
,
self
.
singer
,
self
.
album
,
self
.
genre
,
self
.
date
,
self
.
likes
,
self
.
keywords
]
except
:
return
[
self
.
year
,
self
.
month
,
self
.
rank
,
self
.
title
,
self
.
singer
,
self
.
album
,
self
.
genre
,
self
.
date
,
self
.
likes
,
[]]
def
saveImg
(
self
):
self
.
img
.
save
(
'./images/'
+
self
.
album
+
'.jpg'
)
\ No newline at end of file
Please
register
or
login
to post a comment