comparison scald_dailymotion.module @ 4:fd5fb845d0bc

Add an auto-import admin screen
author Franck Deroche <franck@defr.org>
date Mon, 19 Jul 2010 14:46:20 +0200
parents 2a63a6e15166
children f0e59759c605
comparison
equal deleted inserted replaced
3:2a63a6e15166 4:fd5fb845d0bc
1 <?php 1 <?php
2 // $Id$
3 /**
4 * @file
5 * Defines a DailyMotion provider for Scald.
6 */
2 define('DAILYMOTION_RSS', 'http://www.dailymotion.com/rss/'); 7 define('DAILYMOTION_RSS', 'http://www.dailymotion.com/rss/');
3 define('NS_MEDIA', 'http://search.yahoo.com/mrss'); 8 define('NS_MEDIA', 'http://search.yahoo.com/mrss');
4 define('NS_DM', 'http://www.dailymotion.com/dmrss'); 9 define('NS_DM', 'http://www.dailymotion.com/dmrss');
5 10
6 /** 11 /**
40 function scald_dailymotion_theme() { 45 function scald_dailymotion_theme() {
41 return array( 46 return array(
42 'scald_dailymotion_player' => array( 47 'scald_dailymotion_player' => array(
43 'arguments' => array('video' => NULL, 'thumbnail' => NULL), 48 'arguments' => array('video' => NULL, 'thumbnail' => NULL),
44 'template' => 'scald_dailymotion_player' 49 'template' => 'scald_dailymotion_player'
50 ),
51 'scald_dailymotion_imports_table' => array(
52 'arguments' => array('form' => NULL),
53 'file' => 'scald_dailymotion.admin.inc'
45 ) 54 )
46 ); 55 );
56 }
57
58 /**
59 * Implements hook_perm.
60 */
61 function scald_dailymotion_perm() {
62 return array('administer dailymotion imports');
63 }
64
65 /**
66 * Implements hook_cron.
67 */
68 function scald_dailymotion_cron() {
69 $imports = variable_get('scald_dailymotion_imports', array());
70 foreach ($imports as $import) {
71 $items = scald_dailymotion_feed($import['type'], $import['value']);
72 foreach ($items as $item) {
73 scald_dailymotion_register($item);
74 }
75 }
76 }
77
78 /**
79 * Implements hook_menu.
80 */
81 function scald_dailymotion_menu() {
82 $items = array();
83 $items['admin/settings/scald_dailymotion'] = array(
84 'title' => 'DailyMotion imports',
85 'page callback' => 'drupal_get_form',
86 'page arguments' => array('scald_dailymotion_imports_form'),
87 'access arguments' => array('administer dailymotion imports'),
88 'description' => 'Configure the videos that should be automatically imported from DailyMotion',
89 'file' => 'scald_dailymotion.admin.inc'
90 );
91 return $items;
47 } 92 }
48 93
49 /** 94 /**
50 * Creates an atom based on a DailyMotion video id or an object 95 * Creates an atom based on a DailyMotion video id or an object
51 * containing the video informations.. 96 * containing the video informations..