Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blastbeng committed Oct 4, 2024
1 parent b3943d1 commit 1bb1e79
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 25 deletions.
8 changes: 4 additions & 4 deletions spotisub/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ def get_user_playlists_run(uuid, offset=0):
if os.environ.get(constants.PLAYLIST_GEN_SCHED, constants.PLAYLIST_GEN_SCHED_DEFAULT_VALUE) == "0":
scheduler.remove_job(id=constants.JOB_UP_ID)
else:
playlists = get_user_playlists_array([])
if len(playlists) > 0 and os.environ.get(constants.PLAYLIST_GEN_SCHED, constants.PLAYLIST_GEN_SCHED_DEFAULT_VALUE) != "0":
item = random.choice(playlists)
playlist_infos = database.select_playlist_info_by_type(constants.JOB_UP_ID)
if len(playlist_infos) > 0 and os.environ.get(constants.PLAYLIST_GEN_SCHED, constants.PLAYLIST_GEN_SCHED_DEFAULT_VALUE) != "0":
playlist_info = random.choice(playlist_infos)
scheduler.modify_job(
args=[item.uuid],
args=[playlist_info.uuid],
id=constants.JOB_UP_ID
)
else:
Expand Down
53 changes: 51 additions & 2 deletions spotisub/static/css/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ progress[value]::-webkit-progress-value {
line-height: 20px;
position: absolute;
max-height: 352px;
width: 400px;
width: 300px;
will-change: transform;
top: 108px;
left: 270px;
Expand All @@ -706,6 +706,10 @@ progress[value]::-webkit-progress-value {
display: flex;
flex-direction: column;
}
.MenuContent-scroller-buttons {
display: inline;
padding: 20px;
}

.MenuItem-menuItem {
overflow: hidden !important;
Expand Down Expand Up @@ -738,4 +742,49 @@ progress[value]::-webkit-progress-value {
justify-content: space-between;
white-space: nowrap;
padding: 10px;
}
}


.button-alert-confirm {
display: inline-block;
padding: 10px 15px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #04AA6D;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
}

.button-alert-confirm:hover {background-color: #3e8e41}

.button-alert-confirm:active {
background-color: #3e8e41;
box-shadow: 0 5px #666;
transform: translateY(4px);
}

.button-alert-close {
display: inline-block;
padding: 10px 15px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #ff0000;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
}

.button-alert-close:hover {background-color: #3e8e41}

.button-alert-close:active {
background-color: #ff0000;
box-shadow: 0 5px #666;
transform: translateY(4px);
}
10 changes: 2 additions & 8 deletions spotisub/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,13 @@ function callUrl(url){
let xhr = new XMLHttpRequest();

xhr.open("GET", url, true);

xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
alert("Rescan job has been started!")
}
}
xhr.send();
}



window.addEventListener('click', function(e){
if (e.target.id !== 'show-toolbar-popup') {
if (e.target.id !== 'show-toolbar-popup' && e.target.id !== 'rescan-button') {
var element1 = document.getElementById("toolbar-root-sort");
if (element1 != null && element1 !== 'undefined' && !element1.contains(e.target) && !element1.classList.contains("nodisplay") ) {
element1.classList.add("nodisplay");
Expand All @@ -78,7 +72,7 @@ window.addEventListener('click', function(e){
element3.classList.add("nodisplay");
}
var element4 = document.getElementById("toolbar-root-rescan");
if (element4 != null && element3 !== 'undefined' && !element3.contains(e.target) && !element4.classList.contains("nodisplay") ) {
if (element4 != null && element4 !== 'undefined' && !element4.contains(e.target) && !element4.classList.contains("nodisplay") ) {
element4.classList.add("nodisplay");
}

Expand Down
8 changes: 5 additions & 3 deletions spotisub/static/js/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ function showRescanAlert(){
} else {
element.classList.add("nodisplay");
}
hideToolbarElement("toolbar-root-sort")
}

function closeRescanAlert(){
var element = document.getElementById("toolbar-root-rescan");
if ( element.classList.contains("nodisplay") ) {
element.classList.remove("nodisplay");
}
if ( !element.classList.contains("nodisplay") ) {
element.classList.add("nodisplay");
}
hideToolbarElement("toolbar-root-sort")
}
14 changes: 6 additions & 8 deletions spotisub/templates/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% if title == 'Playlist' %}
<button type="button" id="show-toolbar-popup" onClick="showRescanAlert();" class="PageToolbarButton-toolbarButton Link-link Link-link" title="Rescan and reimport">
<i id="rescan-button" id="show-toolbar-popup" class="svg-fa fa fa-sync" aria-hidden="true"></i>
<i id="rescan-button" class="svg-fa fa fa-sync" aria-hidden="true"></i>
<div id="show-toolbar-popup" class="PageToolbarButton-labelContainer">
<div id="show-toolbar-popup" class="PageToolbarButton-label">Rescan</div>
</div>
Expand Down Expand Up @@ -222,17 +222,15 @@
<span class="span-rescan">
Are you sure?
</span>
<div class="MenuContent-scroller Scroller-scroller Scroller-vertical Scroller-autoScroll" tabindex="-1">
<button name="status" onClick="callUrl('{{url_for('reimport', uuid=playlist_info["uuid"])}}');" type="button" class="MenuItem-menuItem Link-link" onclick="clearFilters()">
<div class="MenuContent-scroller-buttons Scroller-scroller Scroller-vertical Scroller-autoScroll" tabindex="-1">
<button name="status" type="button" onClick="closeRescanAlert();" class="button-alert-close" onclick="clearFilters()">
<div class="SelectedMenuItem-item">
Confirm
&nbsp;&nbsp;Close&nbsp;&nbsp;
</div>
</button>
</div>
<div class="MenuContent-scroller Scroller-scroller Scroller-vertical Scroller-autoScroll" tabindex="-1">
<button name="status" type="button" class="MenuItem-menuItem Link-link" onclick="clearFilters()">
<button name="status" onClick="closeRescanAlert();callUrl('{{url_for('reimport', uuid=playlist_info["uuid"])}}');" type="button" class="button-alert-confirm" onclick="clearFilters()">
<div class="SelectedMenuItem-item">
Close
Confirm
</div>
</button>
</div>
Expand Down

0 comments on commit 1bb1e79

Please sign in to comment.