Jump to content


Photo

[Fixed] Search iTunes Store w/ feedback


  • Please log in to reply
41 replies to this topic

#1 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 25 January 2013 - 08:06 PM

Hey all! I've written a minor riff on Pedro Lobo's App Store Linker workflow that searches the iTunes Store, generating feedback in Alfred and linking directly to the selected item in iTunes. You can get it on AlfPT or at this link.


Edited by phyllisstein, 29 March 2013 - 07:01 PM.

alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#2 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 26 January 2013 - 01:29 AM

Updated to include caching of HTTP requests, to somewhat more reliably return only music tracks, to return 15 results instead of 10, and to fix a silly mistake with the cache folder. This version also adds an app-store search.

 

This is probably going to be the last update before it's rewritten to use the module I'm working on, but please let me know if anything breaks in the meantime.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#3 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 26 January 2013 - 01:51 AM

Excellent. I didn't manage to bundle requests_cache either. I need to update my workflow with a few requested features and implement some sort of cache, not only for images but for all other results. As is, it's woefully slow.

#4 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 26 January 2013 - 02:19 AM

Excellent. I didn't manage to bundle requests_cache either. I need to update my workflow with a few requested features and implement some sort of cache, not only for images but for all other results. As is, it's woefully slow.

 

Yeah, the iTunes API seems a little sluggish. I found that just caching images was enough, but that doesn't do a lick of good with new searches. As for bundling requests_cache, if you have both "requests" and "requests_cache" in your workflow's folder, you can alter `requests_cache/core.py` so that its imports look like this:

import os
import sys

superpath = os.path.realpath("../")
if superpath not in sys.path:
    sys.path.insert(0, superpath)

from requests import Request
try:
    from requests.hooks import dispatch_hook
except ImportError:
    dispatch_hook = None

 

That'll cause it to find the requests module and patch it appropriately, at least as far as I can tell from eyeballing the speed pre- and post-change. When downloading a bundleable requests, be sure to check their git repository for a version tagged 0.14.2; 1.x.x won't work with requests_cache.


  • Pedro Lobo likes this

alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#5 laurindel

laurindel

    Newbie

  • Member
  • Pip
  • 9 posts
  • Locationspain

Posted 26 January 2013 - 09:35 AM

Simply great. Awesome job.



#6 hankydysplasia

hankydysplasia

    Member

  • Member
  • PipPip
  • 23 posts
  • LocationIllinois

Posted 26 January 2013 - 08:19 PM

Love it!  Any way to put specific triggers that load apps instead of music?



#7 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 26 January 2013 - 09:26 PM

Love it!  Any way to put specific triggers that load apps instead of music?

Check my workflow here: App Store Linker It's specific to apps, iOS and Mac.

 

Needs improvements though, but hopefully this weekend I'll get some time to do those.



#8 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 26 January 2013 - 09:27 PM

Yeah, the iTunes API seems a little sluggish. I found that just caching images was enough, but that doesn't do a lick of good with new searches. As for bundling requests_cache, if you have both "requests" and "requests_cache" in your workflow's folder, you can alter `requests_cache/core.py` so that its imports look like this:
import os
import sys

superpath = os.path.realpath("../")
if superpath not in sys.path:
    sys.path.insert(0, superpath)

from requests import Request
try:
    from requests.hooks import dispatch_hook
except ImportError:
    dispatch_hook = None

 

That'll cause it to find the requests module and patch it appropriately, at least as far as I can tell from eyeballing the speed pre- and post-change. When downloading a bundleable requests, be sure to check their git repository for a version tagged 0.14.2; 1.x.x won't work with requests_cache.

 

Sweet!! Thanks for the tip. I'll try and work that into the next version of App Store Linker this weekend.



#9 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 26 January 2013 - 10:02 PM

Love it!  Any way to put specific triggers that load apps instead of music?

 

Try this version.

 

It's basically not that different from Pedro's workflow, it just doesn't attach an affiliate link. Haven't yet figured out how to generate a link directly to the store, so it just bounces you to the App Store webpage for the app.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#10 hankydysplasia

hankydysplasia

    Member

  • Member
  • PipPip
  • 23 posts
  • LocationIllinois

Posted 27 January 2013 - 04:50 AM

Try this version: http://d.pr/f/lhYg

 

It's basically not that different from Pedro's workflow, it just doesn't attach an affiliate link. Haven't yet figured out how to generate a link directly to the store, so it just bounces you to the App Store webpage for the app.

 

That's a nice workflow because it includes a link to both the Mac App Store and iTunes which is a good consolidation.  However, I'm interested in searching iTunes App Store for iOS Apps.  For example, the query "its Carcassonne" yields the useless music below instead of my favorite iOS app.

 

screenshot-1359262012.jpg


 


#11 hollowm4n

hollowm4n

    Newbie

  • Member
  • Pip
  • 12 posts
  • LocationBelgium

Posted 27 January 2013 - 08:44 AM

Could you add a delay before it starts searching the iTunes store?  

When I search for James Horner it will feedback results for Ja, after a few seconds I get results for James and after a few more seconds I get the results for James Horner. 

 

Cheers :)



#12 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 27 January 2013 - 09:28 AM

That's a nice workflow because it includes a link to both the Mac App Store and iTunes which is a good consolidation.  However, I'm interested in searching iTunes App Store for iOS Apps.  For example, the query "its Carcassonne" yields the useless music below instead of my favorite iOS app.

 

 

I'll change the next version so that the "app" query searches iOS apps as well as Mac software.

 

 

Could you add a delay before it starts searching the iTunes store?  

When I search for James Horner it will feedback results for Ja, after a few seconds I get results for James and after a few more seconds I get the results for James Horner. 

 

Cheers :)

 

I haven't come up with a way to do this that I especially like. The script is executed over and over again as the user types, so adding a fixed delay would just reproduce the problem you're seeing with the scripted delay added to the delay that's already endemic to the search. David suggested not executing a search until after a few letters are typed, which is what I'll try next, but you'll still see the same problem: if you want abcdefgh, it'll search for abc, abcde, abcdefgh. Meaning it eliminates maybe one useless search from the sequence.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#13 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 27 January 2013 - 01:45 PM

Well, in spite of my skepticism, David was naturally correct: waiting until a few characters have been typed seems to greatly improve the perceived speed of the search. Let me know if it looks that way on your end. I've also changed the "app" query so that it searches for both iOS and Mac apps, and reworked the code to take advantage of PyAl. You can download it at the original link above.

 

Edit: Further updated to reflect some changes in PyAl, it now appears to be just blazingly fast on my end. Hope you're all noticing similar improvements.

 

Edit Edit: However, the bundled libraries have made it too large for AlfPT, so keep an eye on this thread for further updates.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#14 hollowm4n

hollowm4n

    Newbie

  • Member
  • Pip
  • 12 posts
  • LocationBelgium

Posted 27 January 2013 - 03:02 PM

Well, in spite of my skepticism, David was naturally correct: waiting until a few characters have been typed seems to greatly improve the perceived speed of the search. Let me know if it looks that way on your end. I've also changed the "app" query so that it searches for both iOS and Mac apps, and reworked the code to take advantage of PyAl. You can download it at the original link above or here: http://d.pr/f/XEwn

 

Edit: Further updated to reflect some changes in PyAl, it now appears to be just blazingly fast on my end. Hope you're all noticing similar improvements.

 

Edit Edit: However, the bundled libraries have made it too large for AlfPT, so keep an eye on this thread for further updates.

 

I'm not getting any results after installing this update. It keeps 'Searching...' 



#15 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 27 January 2013 - 03:35 PM

I'm not getting any results after installing this update. It keeps 'Searching...' 

 

It's working fine for me. What are you searching for? If it's under three characters the search won't be executed anymore. If that's not the problem, please change the command in the workflow to "python its.py '{query}' 2>&1 | tee output.log" and post what output.log shows.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#16 hollowm4n

hollowm4n

    Newbie

  • Member
  • Pip
  • 12 posts
  • LocationBelgium

Posted 27 January 2013 - 03:43 PM

It's working fine for me. What are you searching for? If it's under three characters the search won't be executed anymore. If that's not the problem, please change the command in the workflow to "python its.py '{query}' 2>&1 | tee output.log" and post what output.log shows.

 

Here is the log:

 

 

Traceback (most recent call last):
  File "its.py", line 3, in <module>
    import PyAl
  File "/Users/christophe/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EA4B5E15-822A-41B9-A595-FE41EAAB4526/PyAl/__init__.py", line 1, in <module>
    from .core import *
  File "/Users/christophe/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EA4B5E15-822A-41B9-A595-FE41EAAB4526/PyAl/core.py", line 9, in <module>
    import requests_cache
  File "/Users/christophe/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EA4B5E15-822A-41B9-A595-FE41EAAB4526/PyAl/requests_cache/__init__.py", line 28, in <module>
    from .core import(
  File "/Users/christophe/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EA4B5E15-822A-41B9-A595-FE41EAAB4526/PyAl/requests_cache/core.py", line 18, in <module>
    from requests import Request
ImportError: No module named requests

 

:)



#17 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 27 January 2013 - 03:58 PM

Here is the log:

 

Oh how embarrassing. I forgot I'd installed requests and requests_cache separately and wasn't testing from a clean installation. Working on the fix now; give me a few minutes.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#18 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 27 January 2013 - 04:12 PM

Here is the log:

 

Okay, I cleaned the two libraries from my Python setup, forcing it to rely on what's in PyAl, and it appears to be working now. Try this version, and do let me know if it's better.


Sorry for the inconvenience!


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#19 hollowm4n

hollowm4n

    Newbie

  • Member
  • Pip
  • 12 posts
  • LocationBelgium

Posted 27 January 2013 - 04:49 PM

Okay, I cleaned the two libraries from my Python setup, forcing it to rely on what's in PyAl, and it appears to be working now. Try this version, and do let me know if it's better: http://d.pr/f/E5r7


Sorry for the inconvenience!

 

It's working :) great job!



#20 hollowm4n

hollowm4n

    Newbie

  • Member
  • Pip
  • 12 posts
  • LocationBelgium

Posted 27 January 2013 - 05:45 PM

I'm not getting any results in your amazon and kindle workflows. Might be a similar issue. 

 

Cheers :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users