Skip to content
Browse files

chipy json started

  • Loading branch information...
1 parent ac64b70 commit 78451782e0d2d1d782575ac240be8a5fd0ef953e @CarlFK committed May 10, 2012
Showing with 69 additions and 5 deletions.
  1. +58 −0 dj/scripts/addeps.py
  2. +3 −4 dj/scripts/run_tests.py
  3. +8 −1 dj/scripts/tsdv.py
View
58 dj/scripts/addeps.py
@@ -662,6 +662,50 @@ def flourish_events(self, schedule ):
return events
+ def chipy_events(self, schedule ):
+ # flourish 2012
+
+ # these fields exist in both json and veyepar:
+ common_fields = [ 'description',
+ 'durration',
+ 'released', ]
+
+ # mapping of json to veyepar:
+ field_map = [
+ ('title', 'name'),
+ ('start_time', 'start'),
+ ('presenter', 'authors'),
+ ('contact_email','contact'),
+ ]
+
+ events=[]
+ for row in schedule:
+ if self.options.verbose: print row
+ event={}
+
+ for k in common_fields:
+ try:
+ event[k] = row[k]
+ except KeyError:
+ event[k] = 'missing'
+
+ for k1,k2 in field_map:
+ event[k2] = row[k1]
+
+ event['start'] = datetime.datetime.strptime(
+ event['start'], '%m/%d/%Y %H:%M:%S' )
+
+ # event['duration'] = duration
+ event['location'] = 'room_1'
+
+ # save the original row so that we can sanity check end time.
+ event['raw'] = row
+
+ events.append(event)
+
+ return events
+
+
def goth_events(self, schedule ):
@@ -953,6 +997,15 @@ def flourish(self, schedule, show):
return
+ def chipy(self, schedule, show):
+ rooms = ['room_1']
+ self.add_rooms(rooms,show)
+
+ events = self.chipy_events(schedule)
+ self.add_eps(events, show)
+ return
+
+
def zoo(self, schedule, show):
rooms = self.zoo_cages(schedule)
@@ -1085,6 +1138,7 @@ def one_show(self, show):
'pycon_2012': "https://us.pycon.org/2012/schedule/json/",
'xpycon_2012': "file://pc2012.json",
'flourish_2012': "http://flourishconf.com/2012/schedule_json.php",
+ 'chipy_may2012': "http://72.14.188.25:8095/meetings/1/topics.json",
}[self.options.show]
if self.options.verbose: print url
@@ -1120,6 +1174,10 @@ def one_show(self, show):
# look at fingerprint of file, call appropiate parser
+ if self.options.show == 'chipy_may2012':
+ # chipy
+ return self.chipy(schedule,show)
+
if self.options.show == 'flourish_2012':
# flourish_2012
return self.flourish(schedule,show)
View
7 dj/scripts/run_tests.py
@@ -440,18 +440,17 @@ def main():
t.make_test_user()
t.setup_test_data()
t.make_dirs() # don't skip this, it sets self.show_dir and stuff
- """
- t.make_source_dvs()
- t.make_source_footer()
+ # t.make_source_dvs()
+ # t.make_source_footer()
t.add_dv()
+ return
t.make_thumbs()
t.make_cut_list()
## test missing dv files
# os.remove('/home/carl/Videos/veyepar/test_client/test_show/dv/test_loc/2010-05-21/00_00_03.dv')
t.encode()
t.ck_errors()
t.play_vid()
- """
result['url'] = t.post_yt()
result['tweet'] = t.tweet()
t.csv()
View
9 dj/scripts/tsdv.py
@@ -28,7 +28,8 @@ def one_dv(self, dir, dv ):
"""
get the start of this clip
- dv.filename generally looks like this: room/2012-01-14/10:01:34.dv
+ dv.filename generally looks like this: 2012-01-14/10:01:34.dv
+ dir is generally ~/Videos/veyepar/client/show/dv/room
parse the dir and filename strings.
get filesystem_create also
report differences
@@ -37,6 +38,7 @@ def one_dv(self, dir, dv ):
pathname = os.path.join(dir,dv.filename)
print pathname
+ print dv.filename
# get timestamp from filesystem
st = os.stat(pathname)
@@ -75,6 +77,11 @@ def one_dv(self, dir, dv ):
dv.start = start
dv.duration = duration
+ print start
+ print ts_start
+ print ts_start - start
+ print
+
if not self.options.test:
dv.save()

0 comments on commit 7845178

Please sign in to comment.
Something went wrong with that request. Please try again.