Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
invious committed Jun 5, 2019
1 parent 586a701 commit 4805289
Show file tree
Hide file tree
Showing 17 changed files with 309 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added 2C2540F4-B114-408C-AF38-1F2DA4799A87.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# alfred3-songkick
Automatically gives you links to the track on your clipboard for all music platforms provided by Songkick.


## Issues
If you are having issues, check the debugger.

### Missing Python Packages

Best advice is to run `pip install --user -U pip` and then do `which python` to find your python executable.

You will also need to find the workflow data folder:

![](https://i.imgur.com/ESFMLvO.png)

```
pip install --user -U pip
/path/to/your/python -m pip install --target /workflow-data-folder requests
/path/to/your/python -m pip install --target /workflow-data-folder lxml
```
52 changes: 52 additions & 0 deletions extract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import json
import sys

import requests
import lxml.html

url = "https://songwhip.com/"

querystring = {"utm_source":"songwhip-home-paste"}

payload = sys.argv[1]
headers = {
'origin': "https://songwhip.com",
'accept-language': "en-US,en;q=0.9",
'cookie': "__cfduid=de68de6f9e9fc6fc795e27a5e8c4a7c9d1559767541",
'pragma': "no-cache",
'user-agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36",
'content-type': "application/json",
'accept': "*/*",
'cache-control': "no-cache,no-cache",
'authority': "songwhip.com",
'referer': "https://songwhip.com/",
'dnt': "1",
'Postman-Token': "37c18515-02d5-4763-90c2-43684ec0aa26"
}

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

links_page = requests.request("GET", response.json()['url'])
doc = lxml.html.fromstring(links_page.content)


things = doc.xpath('//*[@id="main"]/div/div/div[1]/div[2]/div/div/ul/li')

link_dict = {thing.xpath('.//a')[0].text: thing.xpath('.//a')[0].get('href') for thing in things}

data = {"items":
[
{
"uid": "desktop",
"title": source,
"arg": link,
"autocomplete": "Desktop",
"icon": {
"type": "fileicon",
"path": "~/Desktop"
}
} for source, link in link_dict.items()
]
}

sys.stdout.write(json.dumps(data))
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Apple Music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Spotify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/amazon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/deezer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/google play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/tidal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/youtube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
220 changes: 220 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.invious.alfred3.songkick</string>
<key>connections</key>
<dict>
<key>2C2540F4-B114-408C-AF38-1F2DA4799A87</key>
<array>
<dict>
<key>destinationuid</key>
<string>6D143823-70EB-4632-9F89-51996A7669C4</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>4A0D8708-ADC1-4F10-847D-77870EF4848C</key>
<array/>
<key>5165977B-A4C5-4F9B-9BD8-EC00E5F87A65</key>
<array>
<dict>
<key>destinationuid</key>
<string>4A0D8708-ADC1-4F10-847D-77870EF4848C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>6D143823-70EB-4632-9F89-51996A7669C4</key>
<array>
<dict>
<key>destinationuid</key>
<string>5165977B-A4C5-4F9B-9BD8-EC00E5F87A65</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Aymon Fournier</string>
<key>description</key>
<string>Music streaming URL cross conversion using songwhip.com</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Songwhip</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>sw</string>
<key>subtext</key>
<string>Enter a URL (without argument the clipboard content will be used).</string>
<key>text</key>
<string>Convert a music streaming URL using songwhip.com</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>2C2540F4-B114-408C-AF38-1F2DA4799A87</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<true/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>2</integer>
<key>escaping</key>
<integer>68</integer>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Getting results from songwhip.com...</string>
<key>script</key>
<string>CLIP=$(pbpaste)
python extract.py "$CLIP"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Enter a URL (without argument the clipboard content will be used).</string>
<key>title</key>
<string>Convert a music streaming URL using songwhip.com</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>5165977B-A4C5-4F9B-9BD8-EC00E5F87A65</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argument</key>
<string>{query}</string>
<key>variables</key>
<dict>
<key>cb</key>
<string>{clipboard}</string>
<key>url</key>
<string>{query}</string>
</dict>
</dict>
<key>type</key>
<string>alfred.workflow.utility.argument</string>
<key>uid</key>
<string>6D143823-70EB-4632-9F89-51996A7669C4</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>spaces</key>
<string></string>
<key>url</key>
<string>{query}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
<key>uid</key>
<string>4A0D8708-ADC1-4F10-847D-77870EF4848C</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>v1.2
* songwhip url is now the converted one
+ provider specific icons
+ cmd changes the subtitle to "Copy to clipboard"
+ alt (option) shows the extracted url
v1.1
- search source restricted to clipboard content
+ workflow processes the result of songwhip.com query and generates a list
v1.0
- Nothing fancy, just searches on songwhip.com using the argument or the clipboard content if no argument specified.</string>
<key>uidata</key>
<dict>
<key>2C2540F4-B114-408C-AF38-1F2DA4799A87</key>
<dict>
<key>note</key>
<string>Convert streaming music URL with using songwhip.com</string>
<key>xpos</key>
<integer>40</integer>
<key>ypos</key>
<integer>30</integer>
</dict>
<key>4A0D8708-ADC1-4F10-847D-77870EF4848C</key>
<dict>
<key>xpos</key>
<integer>620</integer>
<key>ypos</key>
<integer>80</integer>
</dict>
<key>5165977B-A4C5-4F9B-9BD8-EC00E5F87A65</key>
<dict>
<key>xpos</key>
<integer>400</integer>
<key>ypos</key>
<integer>40</integer>
</dict>
<key>6D143823-70EB-4632-9F89-51996A7669C4</key>
<dict>
<key>xpos</key>
<integer>260</integer>
<key>ypos</key>
<integer>60</integer>
</dict>
</dict>
<key>version</key>
<string>1.2</string>
<key>webaddress</key>
<string>github.com/invious</string>
</dict>
</plist>
9 changes: 9 additions & 0 deletions packal/hu.csokolade.fns.songwhip.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7y2h7O7KEqTwg+HJ1o9K
ljly3qXZHuVIlpcAzhIm9f4abUSWt/9OXDcOpSaKa4EXslWvXZnyA7reTbnpnb8M
+rgc6ngd1mQpI4cyH3ogE1zAVV7kzLSHJuvAmKEsXGK8bxXK63X7us2WV+sbbDyZ
gXW6UgIw6xUxT7W2cGCCPOpiS3i2/cUnYq50//LVJCQhJj4ji04Q6yXWjZSnjst/
6tOdhpaXhJGy86Z9SUyLwRx+p2IfJLBp7paMPvBC1nD/6r7JTTjfLxpOo0OIOtKX
Jpzxb7Vh19/+2Iu+9/XmpdcGd4mT2QW5CgdJReUSIkK2QG0STV7Rlc2zxStc2klt
yQIDAQAB
-----END PUBLIC KEY-----
8 changes: 8 additions & 0 deletions packal/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8' ?>
<workflow>
<name>Songwhip</name>
<version>1.2</version>
<bundle>hu.csokolade.fns.songwhip</bundle>
<updated>1536893298</updated>
<file>songwhip.alfredworkflow</file>
</workflow>
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[install]
prefix=

0 comments on commit 4805289

Please sign in to comment.