Skip to content

Commit

Permalink
lint + fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
michellebrier committed Feb 29, 2024
1 parent 03c97d5 commit f4bf9ef
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/discovery-provider/src/api/v1/models/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"favorite_count": fields.Integer(required=True),
"total_play_count": fields.Integer(required=True),
"user": fields.Nested(user_model, required=True),
"ddex_app": fields.String(allow_null=True)
"ddex_app": fields.String(allow_null=True),
},
)

Expand Down
6 changes: 5 additions & 1 deletion packages/discovery-provider/src/api/v1/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ def get_stream_url_from_content_node(content_node: str, path: str):

try:
response = requests.get(stream_url, headers=headers, timeout=5)
if response.status_code == 206 or response.status_code == 204 or response.status_code == 200:
if (
response.status_code == 206
or response.status_code == 204
or response.status_code == 200
):
return parsed_url.geturl()
except:
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
EntityType,
ManageEntityParameters,
copy_record,
validate_signer,
is_ddex_signer,
validate_signer,
)
from src.tasks.metadata import immutable_playlist_fields
from src.tasks.task_helpers import generate_slug_and_collision_id
Expand Down Expand Up @@ -344,8 +344,12 @@ def dispatch_challenge_playlist_upload(

def validate_update_ddex_playlist(params: ManageEntityParameters, playlist_record):
if playlist_record.ddex_app:
if playlist_record.ddex_app != params.signer or not is_ddex_signer(params.signer):
raise IndexingValidationError(f"Signer {params.signer} does not have permission to {params.action} DDEX playlist {playlist_record.playlist_id}")
if playlist_record.ddex_app != params.signer or not is_ddex_signer(
params.signer
):
raise IndexingValidationError(
f"Signer {params.signer} does not have permission to {params.action} DDEX playlist {playlist_record.playlist_id}"
)


def update_playlist(params: ManageEntityParameters):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
EntityType,
ManageEntityParameters,
copy_record,
validate_signer,
is_ddex_signer,
validate_signer,
)
from src.tasks.metadata import immutable_track_fields
from src.tasks.task_helpers import generate_slug_and_collision_id
Expand Down Expand Up @@ -490,7 +490,9 @@ def create_track(params: ManageEntityParameters):
def validate_update_ddex_track(params: ManageEntityParameters, track_record):
if track_record.ddex_app:
if track_record.ddex_app != params.signer or not is_ddex_signer(params.signer):
raise IndexingValidationError(f"Signer {params.signer} does not have permission to {params.action} DDEX track {track_record.track_id}")
raise IndexingValidationError(
f"Signer {params.signer} does not have permission to {params.action} DDEX track {track_record.track_id}"
)


def update_track(params: ManageEntityParameters):
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery-provider/src/tasks/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class PlaylistMetadata(TypedDict):
is_album: Optional[bool]
is_private: Optional[bool]
is_image_autogenerated: Optional[bool]
ddex_app: Optional[str],
ddex_app: Optional[str]


playlist_metadata_format: PlaylistMetadata = {
Expand Down

0 comments on commit f4bf9ef

Please sign in to comment.