Skip to content

Commit

Permalink
fix: uuid instead of uid (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare authored Jan 11, 2022
1 parent 5e37ce0 commit cc789b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions nowplaypadgen/show.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Show module for broadcast shows."""

import uuid
from uuid import uuid4

from nowplaypadgen import timeperiod

Expand Down Expand Up @@ -46,15 +46,15 @@ class Show(timeperiod.TimePeriod):
True
"""

def __init__(self, name=None, uid=uuid.uuid4()):
def __init__(self, name=None, uuid=uuid4()):
"""Create Show instance.
:param str name: The name of the show.
:param uuid.UUID uid: The UUID of the show.
:param uuid.UUID uuid: The UUID of the show.
"""

self.name = name #: The show's name
self.uid = uid #: The show's global unique identifier (UUID)
self.uuid = uuid #: The show's global unique identifier (UUID)
self.description = None #: The show's description
self.url = None #: The show's URL
# Call the parent's constructor
Expand All @@ -63,12 +63,12 @@ def __init__(self, name=None, uid=uuid.uuid4()):
def __str__(self) -> str:
"""Return a string representation of the show, useful for logging.
>>> show = Show('My Show', uid="12345678-1234-1234-1234-123456789012")
>>> show = Show('My Show', uuid="12345678-1234-1234-1234-123456789012")
>>> str(show)
"Show 'My Show' (12345678-1234-1234-1234-123456789012) start: None, end: None, url: None"
:return: String containing the show's name, start time,
end time and URL.
"""
# pylint: disable=line-too-long
return f"Show '{self.name}' ({self.uid}) start: {self.starttime}, end: {self.endtime}, url: {self.url}"
return f"Show '{self.name}' ({self.uuid}) start: {self.starttime}, end: {self.endtime}, url: {self.url}"
10 changes: 5 additions & 5 deletions nowplaypadgen/track.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Audio Track module."""
from __future__ import annotations

import uuid
from uuid import uuid4

import mutagen

Expand All @@ -24,17 +24,17 @@ class Track(timeperiod.TimePeriod):
my_track.set_length(60) # The track has a one minute duration
"""

def __init__(self, artist=None, title=None, uid=uuid.uuid4()):
def __init__(self, artist=None, title=None, uuid=uuid4()):
"""Create :class:`track.Track` instance.
:param str artist: The artist of the track
:param str title: The title of the track
:param str uid: The UUID of the track
:param str uuid: The UUID of the track
"""

self.artist = artist #: The track's artist
self.title = title #: The track's title
self.uid = uid #: The track's global unique identifier (UUID)
self.uuid = uuid #: The track's global unique identifier (UUID)
self.tags = {} #: Optional meta tag dictionary of a track
# Call the parent's constructor
super().__init__()
Expand Down Expand Up @@ -91,4 +91,4 @@ def __str__(self) -> str:
:return: String containing the track's artist and title
"""
return f"Track: {self.artist} - {self.title} ({self.uid})"
return f"Track: {self.artist} - {self.title} ({self.uuid})"
2 changes: 1 addition & 1 deletion tests/test_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_track_artist_title_assign(track_artist, track_title, track):
def test_track_string_rep(track):
"""Test the track string representation."""

expected_string = f"Track: {track.artist} - {track.title} ({track.uid})"
expected_string = f"Track: {track.artist} - {track.title} ({track.uuid})"
assert expected_string == track.__str__()


Expand Down

0 comments on commit cc789b6

Please sign in to comment.