Skip to content

Commit

Permalink
playsheet fixes for upload audio
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwbradw committed Dec 30, 2024
1 parent 135b092 commit 993b8d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 58 deletions.
2 changes: 1 addition & 1 deletion app/api2/app/Http/Routes/podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
return Response::json($iae->getMessage(), 500);
}
} else {
Log::info('audio file not received');
Log::info('audio file not received. will crop from archive logger');
try {
$podcast = Podcast::find($id);
if (!$podcast) {
Expand Down
63 changes: 13 additions & 50 deletions app/js/playsheet/playsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@
}
else {
call.makeXml(this.podcast.show_id);
this.podcast_status = "Podcast was not (re)created as requested by the user.";
this.podcast_status = "Podcast was not created";
}
}
this.submit = function () {
Expand Down Expand Up @@ -903,22 +903,19 @@
this.updatePodcastDate();

if (this.info.id < 1) {
//New Playsheet
//New Playsheet and new podcast
this.info.create_name = this.username;
call.saveNewPlaysheet(this.info, this.playitems, this.podcast, this.promotions).then(
(function (response) {
this.promotions = response.data.ads;
this.info.id = response.data.id;
for (var playitem in this.playitems) {
this.playitems[playitem].playsheet_id = this.info.id;
}
this.promotions = response.data.ads;
this.info.id = response.data.id;
this.podcast.id = response.data.podcast_id;
this.podcast.playsheet_id = response.data.id;
this.tracklist_overlay = true;
//TODO: commented out for now because audio upload on playsheet to be restricted to certain ppl
//if($('#audio_file')[0].files){
//this.uploadAudio(this.podcast.id);
//}else{

this.makePodcastAudio();

//}
Expand All @@ -932,53 +929,19 @@
}).bind(this)
);
} else {
//Existing Playsheet
//New Podcast
if (this.podcast.id < 1) {
this.podcast.playsheet_id = this.info.id;
this.podcast.show_id = this.info.show_id;

call.saveNewPodcast(this.podcast).then(
(function (response) {
this.podcast.id = response.data['id'];
call.savePlaysheet(this.info, this.playitems, this.podcast, this.promotions).then(
(function (response) {
this.tracklist_overlay = true;
//TODO: commented out for now because audio upload on playsheet to be restricted to certain ppl
//if($('#audio_file')[0].files.length > 0){
//this.uploadAudio(response.podcast.id);
//}else{

this.makePodcastAudio();

//}
}).bind(this)
);
}).bind(this)
, (function (error) {
this.podcast_status = "Podcast not created";
this.error = true;
this.log_error(error);
this.tracklist_overlay = true;
}).bind(this)
);
} else {
//Existing Platsheet and Podcast
//Existing Playsheet and Podcast
call.savePlaysheet(this.info, this.playitems, this.podcast, this.promotions).then(
(function (response) {
this.tracklist_overlay = true;
//TODO: commented out for now because audio upload on playsheet to be restricted to certain ppl
//if($('#audio_file')[0].files.length > 0){
//this.uploadAudio(response.podcast.id);
//}else{
if (!this.podcast.url || this.time_changed) {
this.makePodcastAudio();

if (this.podcast.url) {
call.makeXml(this.podcast.show_id);
this.podcast_status = 'Updated podcast.';
}
else {
call.makeXml(this.podcast.show_id);
this.podcast_status = 'Using Existing Podcast Audio.';
this.makePodcastAudio();
this.podcast_status = 'Creating new Podcast Audio from archive log.';
}
//}
}).bind(this)
, (function (error) {
this.podcast_status = "Podcast not created";
Expand All @@ -987,7 +950,7 @@
this.tracklist_overlay = true;
}).bind(this)
);
}

}
}
}
Expand Down
16 changes: 9 additions & 7 deletions app/playsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@

<div class='col4 padded' ng-if="playsheet.info.id > 0">

<h4 ng-if="playsheet.podcast.url" class='text-left'>
<a ng-href="{{playsheet.podcast.url}}" target="blank">Podcast Audio 🔗</a>
</h4>
<h4 ng-if="!playsheet.podcast.url" class='text-left'>Upload Audio File</h4>
<div ng-if="playsheet.podcast.url" >
<h4 class='text-left'>Podcast Audio 🎶✅</h4>
<p><a ng-href="{{playsheet.podcast.url}}" target="blank">{{playsheet.podcast.url}}</a></p>
</div>
<h4 ng-if="!playsheet.podcast.url" class='text-left'>Podcast Audio</h4>
<div ng-if="playsheet.replacingAudio">
<input type="file" name='audio_file' id='audio_file' />
<input type="file" name='audio_file' id='audio_file' style="max-width:270px"/>
<button ng-if="playsheet.canUploadAudio() && !playsheet.podcast.url" type="button" ng-click='playsheet.uploadAudio()' >Upload</button>
<button ng-if="playsheet.canUploadAudio() && playsheet.podcast.url" type="button" ng-click='playsheet.uploadAudio()' >Upload (Replace)</button>
<button ng-click='playsheet.cancelReplaceAudio()'>Cancel</button>
Expand All @@ -113,8 +114,8 @@ class='text-left'>

</div>
<div class='col4 padded' ng-if="playsheet.info.id <= 0">
<h4 class='text-left'>Upload Audio File</h4>
<p>To upload the podcast audio, first Save as a Draft</p>
<h4 class='text-left'>Podcast Audio </h4>
<p>To upload, first Save as a Draft</p>
<button ng-click='playsheet.saveDraft()'>Save Draft</button>
</div>
<div class='col2 padded'>
Expand Down Expand Up @@ -171,6 +172,7 @@ class='text-left'>
<div id='container'>

<pre ng-if="debug" style="font-size:0.8em; color:blue;">
playsheet.podcast:
{{playsheet.podcast | json}}
</pre>
<h3 class='double-padded-top'>Music</h3>
Expand Down

0 comments on commit 993b8d0

Please sign in to comment.