omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. SpotlightKid

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 1
    • Topics 5
    • Posts 47
    • Best 1
    • Controversial 0
    • Groups 0

    SpotlightKid

    @SpotlightKid

    1
    Reputation
    1440
    Profile views
    47
    Posts
    1
    Followers
    0
    Following
    Joined Last Online

    SpotlightKid Unfollow Follow

    Best posts made by SpotlightKid

    • RE: Pythonista sound output only via headphones

      Alright, it seems to have been the mute switch in the control center after all. Sound output from Pythonista now works.

      I guess the mute switch was activated and was implicitly deactivated when I toggled the setting for the hardware switch between rotation lock and mute control in the settings for testing.

      It also seems that all the music apps I'm using, including the iTunes music player, ignore the mute switch. Actually I have yet to find an app on the iPad that honors it (Twitter maybe?).

      posted in Pythonista
      SpotlightKid
      SpotlightKid

    Latest posts made by SpotlightKid

    • RE: Script: remote-controllable digital image frame

      Thanks for the heads up!

      There was an error in the regex to parse the bottle version. Should be fixed now. Your approach unfortunately wouldn't work with version strings like '0.13-dev'. Anyway, I think on Python 2 the version of bottle included with Pythonista should be fine, so I adapted the code to reflect this too.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • Script: remote-controllable digital image frame

      Hi all,

      I needed a way to make my iPad display images scaled to fullscreen without taking my hands off the keyboard/mouse of my main computer. Thus ImageFrame.py was born:

      http://tinyurl.com/iosimageframe

      Just run this script in Pythonista and it will start up with a fullscreen display of the 'test:Lenna' image included in Pythonista. Then use the provided script send-image.py on your main computer to upload an image and have it displayed instead (requires the requests library). The image is added to the Photo Library on your iOS device in an album called "Image Frame" (which will be created if it does not exist yet). I add this script as a handler for images to the right-click context menu of my file browser. You can also point your browser to http://<ip of your ios device>:8080/ and upload an image via an HTML form. Use a 2-finger wipe down to end the script.

      I use this for displaying reference images while drawing or cheat sheets for keyboard shortcuts or programming languages while coding. But it also makes it possible to use your iPad as an over-priced digital image frame ;)

      Bugs / Areas for possible future improvements:

      • Runs on Pythonista 2 or 3, although on Pythonista 3 there are some problems with uploading images through the browser. The send-image.py script simply sends the image via HTTP PUT and this works without problems on both Pythonista 2 and 3.
      • No authentication whatsoever
      • You need to pass the IP address of your iOS device to the upload script or edit it to set the default.
      • The network status, clock and battery status are always displayed at the top of the screen.
      • Some sort of automatic slideshow display would be nice.

      Share & Enjoy, Chris

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Import Scripts written on Mac/PC to Pythonista?

      That's what I would think too. Apparently Apple doesn't. If you can't live with this, don't use Apple products. Life's a bitch.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Import Scripts written on Mac/PC to Pythonista?

      The easiest way for me is usually the Dropbox File Picker.

      Your need to do some initial setup as explained in the comments at the start of the file, but then it's easy and convenient.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Pulling stockdata from the Yahoo

      How about putting the month in the filename:

      filename = "data-%s-%02i.csv" % (stock.replace('^', ''), startdate.month)
      
      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Pulling stockdata from the Yahoo

      Small suggestion:

      from datetime import datetime, date
      
      [...]
      
      month = int(datetime.strftime(date.today(), "%m")) - 1
      year = int(datetime.strftime(date.today(), "%Y"))
      

      This can be just written as:

      from datetime import date
      
      month = date.today().month - 1
      year = date.today().year
      

      No need to format the month/year number into a string and then into an integer again.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Pulling stockdata from the Yahoo

      BTW, if you want to play with the URL parameters (params a-f can be used to set a date range), you can construct the URL params from a dictionary like so (note that the month number has to be minus one):

      STOCK_URL = 'http://ichart.finance.yahoo.com/table.csv'
      PARAMS = {
          'a': 9,
          'b': 1,
          'c': 2014,
          'd': 9,
          'e': 31,
          'f': 2014,
          'g': 'd',
          'ignore': '.csv'
      }
      
      def pulldata(stock, filename):
          params = PARAMS.copy()
          params['s'] = stock
          url = "%s?%s" % (STOCK_URL, urllib.urlencode(params))
          return urllib.urlretrieve(url, filename)
      

      Here's the documentation of the API:

      https://code.google.com/p/yahoo-finance-managed/wiki/csvHistQuotesDownload

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Jono's Pythonista Scripts (Fast Image Sharing, Intuitive File Downloading and more)

      The File2Txt.py file could be written much shorter using shutil.copy() and os.path.splitext().

      In Python is pays to know your standard library well.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Pulling stockdata from the Yahoo

      RUT doesn't seem to be a valid stock identifier. Try '^GDAXI' for the German DAX.

      posted in Pythonista
      SpotlightKid
      SpotlightKid
    • RE: Pulling stockdata from the Yahoo

      Just pass the path of the output file as a second argument to urlretrieve(). The filename is also the first item of the tuple returned by this function.

      import urllib
      
      STOCK_URL = 'http://ichart.finance.yahoo.com/table.csv?s=%s&a=07&b=25&c=2014&d=07&e=29&f=2014&g=d&ignore=.csv'
      
      def pulldata(stock, filename):
          return urllib.urlretrieve(STOCK_URL % urllib.quote(stock), filename)
      
      filename, headers = pulldata("RUT", "RUT-data.csv")
      

      If you want to save the file in your documents folder, build the filename like this (there are several ways to do this, but this one will work on desktop Python as well):

      import os
      from os.path import exists, dirname, join
      
      # create output directory if it doesn't exist yet
      documents = join(os.getenv('HOME'), 'Documents')
      if not exists(documents):
          os.mkdir(documents)
      
      filename = join(documents, 'RUT-data.csv')
      
      posted in Pythonista
      SpotlightKid
      SpotlightKid