Skip to content

Commit 0e5f8b7

Browse files
committed
fixes an issue with playlists and makes them smoother on page scroll, also a bit more detailed install instructions
1 parent dc34f3f commit 0e5f8b7

File tree

5 files changed

+52
-18
lines changed

5 files changed

+52
-18
lines changed

com.ntanis.essentials-for-spotify.sdPlugin/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Name": "Essentials for Spotify",
3-
"Version": "1.0.0.0",
3+
"Version": "1.0.0.1",
44
"Author": "Ntanis",
55
"Actions": [
66
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "essentials-for-spotify",
3-
"version": "1.0.0",
3+
"version": "1.0.0.1",
44
"description": "Effortlessly control your Spotify through your Elgato Stream Deck.",
55
"author": "https://github.com/ntanis-dev",
66
"license": "ISC",

src/actions/items-dial.ts

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
2-
action
2+
action,
3+
WillDisappearEvent
34
} from '@elgato/streamdeck'
45

56
import {
@@ -17,7 +18,7 @@ export default class ItemsDial extends Dial {
1718
#items: any = []
1819
#lastTotal: number = 0
1920

20-
async #refreshItemss(context: string) {
21+
async #refreshItems(context: string) {
2122
if (this.#itemsPage[context] === undefined)
2223
this.#itemsPage[context] = 1
2324

@@ -67,20 +68,20 @@ export default class ItemsDial extends Dial {
6768
this.setIcon(context, 'images/icons/pending.png')
6869
this.#refreshCount(context)
6970

70-
const refreshItemss = await this.#refreshItemss(context)
71+
const refreshItems = await this.#refreshItems(context)
7172

72-
if (refreshItemss) {
73+
if (refreshItems) {
7374
await this.#refreshLayout(true, context)
7475
return false
7576
}
7677

7778
return true
7879
}
7980

80-
async #refreshLayout(refreshItemss = false, context: string) {
81+
async #refreshLayout(refreshItems = false, context: string) {
8182
const nameMarquee = this.getMarquee(context, 'name')
8283

83-
if (refreshItemss) {
84+
if (refreshItems) {
8485
this.resetFeedbackLayout(context, {
8586
name: {
8687
opacity: 1.0
@@ -105,7 +106,7 @@ export default class ItemsDial extends Dial {
105106
this.#currentItems = {}
106107
this.#items = {}
107108

108-
await this.#refreshItemss(context)
109+
await this.#refreshItems(context)
109110

110111
if (this.#items.total === 0) {
111112
this.setIcon(context, this.originalIcon)
@@ -118,11 +119,13 @@ export default class ItemsDial extends Dial {
118119

119120
return
120121
}
121-
} else if (this.#items.items[this.#currentItems[context]] && (!images.isItemCached(this.#items.items[this.#currentItems[context]])))
122-
this.setIcon(context, 'images/icons/pending.png')
123122

124-
if (this.#currentItems[context] === undefined)
125-
this.#currentItems[context] = 0
123+
if (this.#currentItems[context] === undefined)
124+
this.#currentItems[context] = 0
125+
}
126+
127+
if (!images.isItemCached(this.#items.items[this.#currentItems[context]]))
128+
this.setIcon(context, 'images/icons/pending.png')
126129

127130
this.setFeedback(context, {
128131
name: {
@@ -146,7 +149,9 @@ export default class ItemsDial extends Dial {
146149
this.#refreshCount(context)
147150

148151
if (nameMarquee) {
149-
this.updateMarquee(context, 'name', this.#items.items[this.#currentItems[context]].name, this.#items.items[this.#currentItems[context]].name)
152+
if (nameMarquee.original !== this.#items.items[this.#currentItems[context]].name)
153+
this.updateMarquee(context, 'name', this.#items.items[this.#currentItems[context]].name, this.#items.items[this.#currentItems[context]].name)
154+
150155
this.resumeMarquee(context, 'name')
151156
} else
152157
this.marquee(context, 'name', this.#items.items[this.#currentItems[context]].name, this.#items.items[this.#currentItems[context]].name, 11, context)
@@ -185,9 +190,16 @@ export default class ItemsDial extends Dial {
185190
else
186191
this.#itemsPage[context] = 1
187192

188-
if (lastPage !== this.#itemsPage[context])
193+
if (lastPage !== this.#itemsPage[context]) {
194+
this.setFeedback(context, {
195+
name: {
196+
value: '?????'
197+
}
198+
})
199+
189200
if (!(await this.#refreshPage(context)))
190201
return constants.WRAPPER_RESPONSE_API_ERROR
202+
}
191203
}
192204

193205
this.#refreshCount(context)
@@ -211,9 +223,16 @@ export default class ItemsDial extends Dial {
211223
this.#currentItems[context] = this.#items.total - ((this.#itemsPage[context] - 1) * constants.WRAPPER_ITEMS_PER_PAGE) - 1
212224
}
213225

214-
if (lastPage !== this.#itemsPage[context])
226+
if (lastPage !== this.#itemsPage[context]) {
227+
this.setFeedback(context, {
228+
name: {
229+
value: '?????'
230+
}
231+
})
232+
215233
if (!(await this.#refreshPage(context)))
216234
return constants.WRAPPER_RESPONSE_API_ERROR
235+
}
217236
}
218237

219238
this.#refreshCount(context)
@@ -254,8 +273,14 @@ export default class ItemsDial extends Dial {
254273
throw new Error('The fetchItems method must be implemented in a subclass.')
255274
}
256275

276+
277+
async onWillDisappear(ev: WillDisappearEvent<any>): Promise<void> {
278+
await super.onWillDisappear(ev)
279+
this.pauseMarquee(ev.action.id, 'name')
280+
}
281+
257282
updateFeedback(context: string): void {
258283
super.updateFeedback(context)
259-
this.#refreshLayout(true, context)
284+
this.#refreshLayout(this.#lastTotal === 0, context)
260285
}
261286
}

src/ui/setup/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ <h2>
3030
</span>
3131

3232
<ol class="main">
33+
<li>Login to <a href="https://developer.spotify.com" target="_blank" rel="noopener">Spotify for Developers</a> with your Spotify account.</li>
3334
<li>Go to <a href="https://developer.spotify.com/dashboard/create" target="_blank" rel="noopener">Create app - Spotify for Developers</a>.</li>
34-
<li>Set <code id="url">http://127.0.0.1:<span class="port"></span></code> as <b>"Redirect URI"</b>.</li>
35+
<li>Set <code id="url">http://127.0.0.1:<span class="port"></span></code> as <b>"Redirect URI"</b> and click <b>Add</b>.</li>
3536
<li>Check <b>"Web API"</b> in <b>"Which API/SDKs are you planning to use?"</b>.</li>
3637
<li>Fill the rest of the form to your liking, <b>"Website"</b> field can be left empty.</li>
3738
<li>Create the app and navigate to the app's dashboard.</li>
@@ -55,6 +56,10 @@ <h2>
5556
<input type="text" id="clientId" name="clientId" placeholder="Client ID" required />
5657
<input type="text" id="clientSecret" name="clientSecret" placeholder="Client Secret" required />
5758
<input type="submit" value="Submit" />
59+
60+
<br />
61+
62+
<small>If you get "<b>INVALID_CLIENT: Invalid redirect URI</b>":<br />Make sure you have copied the <b>Redirect URL</b> exactly as is, without a trailing slash (/).</small>
5863
</form>
5964
</div>
6065

src/ui/setup/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ body {
1616
color: #1db954;
1717
}
1818

19+
small {
20+
text-align: left;
21+
}
22+
1923
.form-container {
2024
max-width: 600px;
2125
margin: 50px auto;

0 commit comments

Comments
 (0)