Changeset 0654705e9cebf971ac00e733c920e9548ae3adcd

Show
Ignore:
Timestamp:
12/16/10 01:24:03 (4 years ago)
Author:
Guillaume Pellerin <yomguy@…>
Children:
7728f7fb84077743867feb0e8c5e30fb1240fd25
Parents:
4334dd720924e001899883b2e290849dc6d9f68d
git-committer:
Guillaume Pellerin <yomguy@parisson.com> / 2010-12-16T00:24:03Z+0000
Message:

add new twitter oauth methods, update doc

Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • INSTALL

    rbed0735 r0654705  
    11# -*- coding: utf-8 -*- 
    22# 
    3 # Copyright (c) 2007-2009 Guillaume Pellerin <pellerin@parisson.com> 
     3# Copyright (c) 2007-2010 Guillaume Pellerin <pellerin@parisson.com> 
    44# All rights reserved. 
    55# 
     
    1010# Author: Guillaume Pellerin <pellerin@parisson.com> 
    1111 
    12  depends:  python, python-dev, python-xml, python-shout | shout-python, libshout3, 
     12 
     13Dependencies 
     14============= 
     15 
     16depends:  python, python-dev, python-xml, python-shout | shout-python, libshout3, 
    1317           libshout3-dev, python-mutagen 
    1418 
    15  provides:  shout-python 
     19provides:  shout-python | python-shout, python-tinyurl 
    1620 
    17  optional: python-twitter, python-tinyurl, python-liblo | pyliblo (>= 0.26) 
     21optional: python-twitter, python-liblo | pyliblo (>= 0.26) 
    1822 
    19  recommends: icecast2 
     23recommends: icecast2 
    2024 
    21 python-shout is included in the DeeFuzzer but needs to be compiled and installed 
    22 if you don't install deefuzzer from its debian package with aptitude. 
    23 As explained in shout-python/INSTALL, you just have to run this command : 
    2425 
    25   $ cd shout-python 
    26   $ sudo python setup.py install 
     26Install 
     27========= 
    2728 
    28 To install the DeeFuzzer (from the main deefuzzer directory) : 
    29  
    30   $ sudo python install.py 
     29To install the DeeFuzzer, go to the main deefuzzer app directory, for example:: 
     30     
     31    cd deefuzzer-0.4.3 
     32     
     33and run the python installer:: 
     34     
     35    sudo python install.py 
    3136 
    3237For more informations, see http://svn.parisson.org/deefuzzer/ 
     38 
     39 
     40Twitter (optional) 
     41===================== 
     42 
     43To get track twitting, please install python-twitter, python-oauth2 and all their dependencies. 
     44As Twitter now requires oauth key system since 07/2010, you need to get your own access token key pair. 
     45Please run the dedicated script to do this:: 
     46     
     47    python tools/get_access_token.py 
     48     
     49You will be invited to copy/paste an URL in your browser to get a pin code. 
     50Then copy/paste this code into the console and press ENTER. 
     51The script gives you a pair of keys : one access token key and one access token secret key. 
     52 
     53Change the <twitter> block options in your deefuzzer XML config file, giving the 2 keys.  
     54For example:: 
     55     
     56    <twitter> 
     57            <mode>1</mode> 
     58            <key>85039615-H6yAtXXCx7NobF5W40FV0c8epGZsQGkE7MG6XRjD2</key> 
     59            <secret>A1YW3llB9H9qVbjH8zOQTOkMlhVqh2a7LnA9Lt0b6Gc</secret> 
     60            <tags>Music Groove</tags> 
     61    </twitter> 
     62     
     63Your DeeFuzzer will now tweet the currently playing track and new tracks on your profile. 
     64 
     65 
     66OSC Control 
     67============= 
     68 
     69Working, but no doc yet. Please read the code :) 
     70 
  • README

    re922416 r0654705  
    5050where CONFIGFILE is the path for a XML config file. For example:: 
    5151 
    52 $ deefuzzer example/myfuzz.xml 
     52    deefuzzer example/myfuzz.xml 
    5353 
    5454To make the deefuzzer act as a deamon, just play it in the background:: 
    5555 
    56 $ deefuzzer example/myfuzz.xml & 
     56    deefuzzer example/myfuzz.xml & 
    5757 
    5858Note that you must edit the config file with right parameters before playing. 
     
    6767after a CTRL+Z, making this:: 
    6868 
    69 $ kill -9 PROCESS_ID 
     69    kill -9 PROCESS_ID 
    7070 
    7171or:: 
    7272 
    73 $ kill -9 `pgrep deefuzzer` 
     73    pkill -9 deefuzzer 
    7474 
    7575 
     
    9090Next track:: 
    9191 
    92 $ python tools/osc_next.py 
     92    python tools/osc_next.py 
    9393 
    9494Start twitting:: 
    9595 
    96 $ python tools/osc_twitter_start.py 
     96    python tools/osc_twitter_start.py 
    9797 
    9898Stop twitting:: 
    9999 
    100 $ python see tools/osc_twitter_stop.py 
     100    python see tools/osc_twitter_stop.py 
    101101 
    102102Start relaying:: 
    103103 
    104 $ python tools/osc_relay_start.py 
     104    python tools/osc_relay_start.py 
    105105 
    106106Stop relaying:: 
    107107 
    108 $ python see tools/osc_relay_stop.py 
     108    python see tools/osc_relay_stop.py 
    109109 
    110110Start jingling:: 
    111111 
    112 $ python see tools/osc_jingles_start.py 
     112    python see tools/osc_jingles_start.py 
    113113 
    114114Stop jingling:: 
    115115 
    116 $ python see tools/osc_jingles_stop.py 
     116    python see tools/osc_jingles_stop.py 
    117117 
    118118 
  • deefuzzer.py

    r4334dd7 r0654705  
    4646from tools import * 
    4747 
    48 version = '0.4.3' 
     48version = '0.5.0' 
    4949year = datetime.datetime.now().strftime("%Y") 
    5050platform_system = platform.system() 
  • example/myfuzz.xml

    r348233e r0654705  
    6161            <mode>0</mode> 
    6262            <!-- Your twitter username --> 
    63             <user>my_twitter_user</user> 
     63            <key>your access token key</key> 
    6464            <!-- Your twitter password --> 
    65             <pass>my_twitter_password</pass> 
     65            <secret>your access token secret key</secret> 
    6666            <!-- These tags will be added to each twitter message --> 
    6767            <tags>bla bla</tags> 
  • tools/station.py

    r3538089 r0654705  
    145145        if 'twitter' in self.station: 
    146146            self.twitter_mode = int(self.station['twitter']['mode']) 
    147             self.twitter_user = self.station['twitter']['user'] 
    148             self.twitter_pass = self.station['twitter']['pass'] 
     147            self.twitter_key = self.station['twitter']['key'] 
     148            self.twitter_secret = self.station['twitter']['secret'] 
    149149            self.twitter_tags = self.station['twitter']['tags'].split(' ') 
    150150            if self.twitter_mode == 1: 
     
    213213        value = value[0] 
    214214        import tinyurl 
    215         self.twitter = Twitter(self.twitter_user, self.twitter_pass) 
     215        self.twitter = Twitter(self.twitter_key, self.twitter_secret) 
    216216        self.twitter_mode = value 
    217217        message = "Received OSC message '%s' with arguments '%d'" % (path, value) 
     
    449449        #self.channel.set_metadata({'song': self.song, 'charset': 'utf8',}) 
    450450        self.update_rss(self.current_media_obj, self.rss_current_file, '(currently playing)') 
    451         self.logger.write_info('Deefuzzing on %s :  id = %s, name = %s' \ 
     451        self.logger.write_info('DeeFuzzing on %s :  id = %s, name = %s' \ 
    452452            % (self.short_name, self.id, self.current_media_obj[0].file_name)) 
    453453        self.player.set_media(self.media) 
     
    460460        artist_names = self.artist.split(' ') 
    461461        artist_tags = ' #'.join(list(set(artist_names)-set(['&', '-']))) 
    462         message = '%s %s on #%s #%s' % (self.prefix, self.song, self.short_name, artist_tags) 
     462        message = '%s %s on #%s #%s' % (self.prefix, self.song, self.short_name, artist_tags) 
    463463        tags = '#' + ' #'.join(self.twitter_tags) 
    464464        message = message + ' ' + tags 
  • tools/twitt.py

    r7301ae6 r0654705  
    3838 
    3939# Twitter DeeFuzzer keys 
    40 TWITTER_CONSUMER_KEY = 'ozs9cPS2ci6eYQzzMSTb4g' 
    41 TWITTER_CONSUMER_SECRET = '1kNEffHgGSXO2gMNTr8HRum5s2ofx3VQnJyfd0es' 
     40DEEFUZZER_CONSUMER_KEY = 'ozs9cPS2ci6eYQzzMSTb4g' 
     41DEEFUZZER_CONSUMER_SECRET = '1kNEffHgGSXO2gMNTr8HRum5s2ofx3VQnJyfd0es' 
    4242 
    4343 
     
    4646    def __init__(self, access_token_key, access_token_secret): 
    4747        import twitter 
    48         self.username = TWITTER_CONSUMER_KEY 
    49         self.password = TWITTER_CONSUMER_SECRET 
     48        self.consumer_key = DEEFUZZER_CONSUMER_KEY 
     49        self.consumer_secret = DEEFUZZER_CONSUMER_SECRET 
    5050        self.access_token_key = access_token_key 
    5151        self.access_token_secret = access_token_secret 
    52         self.api = twitter.Api(username=self.username, 
    53                                password=self.password, 
     52        self.api = twitter.Api(consumer_key=self.consumer_key, 
     53                               consumer_secret=self.consumer_secret, 
    5454                               access_token_key=self.access_token_key, 
    5555                               access_token_secret=self.access_token_secret)