Skip to content

Commit

Permalink
Removed Mixer
Browse files Browse the repository at this point in the history
  • Loading branch information
GodMod committed Jul 12, 2020
1 parent 144b98b commit 5561a05
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 115 deletions.
6 changes: 0 additions & 6 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ private function fields(){
'twitch_clientsecret' => array(
'type' => 'text',
),
),
'mixer' => array(
'mixer_streams' => array(
'type' => 'textarea',
'cols' => 80,
),
),
'youtube' => array(
'youtube_streams' => array(
Expand Down
81 changes: 0 additions & 81 deletions includes/livestream_helper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,6 @@ public function getStreamAccounts(){
);
}

$strMixer = trim($this->pdh->get('user', 'profilefield_by_name', array($intUserID, 'mixer', false, true)));

if($strMixer && $strMixer != ""){

$strUsername = $this->pdh->get('user', 'name', array($intUserID));

$arrAccounts[] = array(
'username' => $strUsername,
'userlink' => $this->routing->build('user', $strUsername, 'u'.$intUserID),
'stream_type' => 'mixer',
'stream_icon' => '<img src="'.$this->server_path.'plugins/livestreams/images/mixer.png" title="Mixer" style="height: 20px;" />',
'stream_link' => 'https://mixer.com/'.str_replace('https://mixer.com/', '', sanitize(utf8_strtolower($strMixer))),
'stream_username' => str_replace('https://mixer.com/', '', utf8_strtolower($strMixer)),
'stream_username_display' => str_replace('https://mixer.com/', '', utf8_strtolower($strMixer)),
);
}

$strYoutube = trim($this->pdh->get('user', 'profilefield_by_name', array($intUserID, 'youtube', false, true)));

if($strYoutube && $strYoutube != ""){
Expand Down Expand Up @@ -130,27 +113,6 @@ public function getStreamAccounts(){
);
}

$strAdditionalAccounts = $this->config->get('mixer_streams', 'livestreams');
if(strlen($strAdditionalAccounts)){
$arrParts = explode("\r\n", $strAdditionalAccounts);
} else {
$arrParts = array();
}

foreach($arrParts as $strMixer){
$strMixer = trim($strMixer);
if($strMixer == "") continue;

$arrAccounts[] = array(
'username' => '',
'userlink' => '',
'stream_type' => 'mixer',
'stream_icon' => '<img src="'.$this->server_path.'plugins/livestreams/images/mixer.png" title="Mixer" style="height: 20px;" />',
'stream_link' => 'https://mixer.com/'.str_replace('https://mixer.com/', '', sanitize(utf8_strtolower($strMixer))),
'stream_username' => str_replace('https://mixer.com/', '', utf8_strtolower($strMixer)),
);
}

$strAdditionalAccounts = $this->config->get('youtube_streams', 'livestreams');
if(strlen($strAdditionalAccounts)){
$arrParts = explode("\r\n", $strAdditionalAccounts);
Expand Down Expand Up @@ -188,7 +150,6 @@ public function queryData($arrAccounts){
}

$arrAccounts = $this->queryTwitch($arrAccounts);
$arrAccounts = $this->queryMixer($arrAccounts);
if($this->strYoutubeClientID != "") $arrAccounts = $this->queryYoutube($arrAccounts);

$arrSortOnline = $arrSortUsername = array();
Expand All @@ -204,48 +165,6 @@ public function queryData($arrAccounts){
return $arrAccounts;
}


public function queryMixer($arrAccounts){
$arrMixerUsers = array();
foreach($arrAccounts as $arrData){
if($arrData['stream_type'] != 'mixer') continue;

$arrMixerUsers[] = $arrData['stream_username'];
}

$arrMixerUsers = array_unique($arrMixerUsers);

$arrReturnData = array();

if(count($arrMixerUsers)){
$arrQueryData = array();
foreach($arrMixerUsers as $strMixername){
$mixRequest = register('urlfetcher')->fetch('https://mixer.com/api/v1/channels/'.$strMixername);
if($mixRequest){
$arrQueryData[$strMixername] = json_decode($mixRequest, true);
}
}
}


//Now combine the results

foreach($arrAccounts as $key => $val){
if($val['stream_type'] != 'mixer') continue;
#$arrAccounts[$key]['stream_data'] = $arrQueryData[$val['stream_username']];
$arrAccounts[$key]['stream_username_display'] = $arrQueryData[$val['stream_username']]['token'];
$arrAccounts[$key]['stream_live'] = ($arrQueryData[$val['stream_username']]['online']) ? 1 : 0;
$arrAccounts[$key]['stream_game'] = ($arrQueryData[$val['stream_username']]['type']['name']) ? $arrQueryData[$val['stream_username']]['type']['name'] : '';
$arrAccounts[$key]['stream_viewer'] = ($arrQueryData[$val['stream_username']]['viewersCurrent']) ? $arrQueryData[$val['stream_username']]['viewersCurrent'] : 0;
$arrAccounts[$key]['stream_avatar'] = $arrQueryData[$val['stream_username']]['user']['avatarUrl'];
$arrAccounts[$key]['stream_background'] = ($arrAccounts[$key]['stream_live']) ? 'https://thumbs.mixer.com/channel/'.$arrQueryData[$val['stream_username']]['id'].'.small.jpg' : $arrQueryData[$val['stream_username']]['bannerUrl'];
}

//Sort by Online, And Displayname

return $arrAccounts;
}

public function queryTwitch($arrAccounts){
$arrTwitchUsers = array();
foreach($arrAccounts as $arrData){
Expand Down
3 changes: 0 additions & 3 deletions language/english/lang_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
'ls_f_twitch_clientsecret' => 'Twitch App Client-Secret',
'ls_f_help_twitch_clientsecret' => 'You can create a Client-Secret by using the button "New Secret".',
'ls_viewer' => 'Viewer',
'ls_fs_mixer' => 'Mixer',
'ls_f_mixer_streams' => 'Mixer-Streams',
'ls_f_help_mixer_streams' => 'Insert here additional Mixer-Streamer, one per line',
'ls_fs_youtube' => 'YouTube',
'ls_f_youtube_streams' => 'YouTube-Streams',
'ls_f_help_youtube_streams' => 'Insert here additional YouTube channels, one per line',
Expand Down
3 changes: 0 additions & 3 deletions language/german/lang_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
'ls_f_twitch_clientsecret' => 'Twitch App Client-Geheimnis',
'ls_f_help_twitch_clientsecret' => 'Das Client-Geheimnis kannst du durch den Button "Neues Geheimnis" erzeugen und anzeigen lassen.',
'ls_viewer' => 'Zuschauer',
'ls_fs_mixer' => 'Mixer',
'ls_f_mixer_streams' => 'Mixer-Streams',
'ls_f_help_mixer_streams' => 'Trage hier zusätzliche Mixer-Streamuser ein, einer pro Zeile',
'ls_fs_youtube' => 'YouTube',
'ls_f_youtube_streams' => 'YouTube-Streams',
'ls_f_help_youtube_streams' => 'Trage hier zusätzliche Youtube-Kanäle ein, einer pro Zeile',
Expand Down
22 changes: 0 additions & 22 deletions livestreams_plugin_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,6 @@ public function pre_install(){
register('pdh')->put('user_profilefields', 'insert_field', array($arrOptions, array()));
}

$intMixerFieldID = register('pdh')->get('user_profilefields', 'field_by_name', array('mixer'));

//Create Twitch Profilefield
if(!$intMixerFieldID){
$arrOptions = array(
'name' => 'Mixer',
'lang_var' => '',
'type' => 'link',
'length' => 30,
'minlength' => 3,
'validation' => '[\w_\.]+',
'required' => 0,
'show_on_registration' => 0,
'enabled' => 1,
'is_contact' => 1,
'contact_url' => 'https://www.mixer.com/%s',
'icon_or_image' => '../plugins/livestreams/images/mixer.png',
'bridge_field' => null,
);

register('pdh')->put('user_profilefields', 'insert_field', array($arrOptions, array()));
}
}


Expand Down

0 comments on commit 5561a05

Please sign in to comment.