Skip to content

Commit

Permalink
Backport changes from 1.2.x build to 1.1.3 build
Browse files Browse the repository at this point in the history
  • Loading branch information
margro committed Oct 23, 2011
1 parent 9f5fb8d commit b3aaf74
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 12 deletions.
6 changes: 6 additions & 0 deletions TVServerXBMC/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.1.3.109:
- Send TvResult as integer to XBMC to be able to show a localized error message when timeshifting fails

1.1.3.108:
- Add GetSignalQuality command

1.1.3.107:
- Fix radio webstream detection when starting a timeshift fails

Expand Down
51 changes: 51 additions & 0 deletions TVServerXBMC/Commands/GetSignalQuality.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Text;
using MPTvClient;

namespace TVServerXBMC.Commands
{
class GetSignalQuality : CommandHandler
{
public GetSignalQuality(ConnectionHandler connection)
: base(connection)
{

}

public override void handleCommand(string command, string[] arguments, ref TvControl.User me)
{
int cardID = -1;
List<string> results = new List<string>();

try
{
if (arguments != null)
{
cardID = Int32.Parse(arguments[0]);
}
else
{
cardID = me.CardId;
}

TVServerController server = TVServerConnection.GetServerInterface();
int level = server.GetSignalLevel(cardID);
int quality = server.GetSignalQuality(cardID);

writer.write(level.ToString() + "|" + quality.ToString());
}
catch
{
Console.WriteLine(getCommandToHandle() + ": failed");
writer.write("");
}
//getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + "[:cardID]");
}

public override string getCommandToHandle()
{
return "GetSignalQuality";
}
}
}
19 changes: 11 additions & 8 deletions TVServerXBMC/Commands/TimeshiftChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ public override void handleCommand(string command, string[] arguments, ref TvCon
}

result = TVServerConnection.playChannel(chanId, resolveToIP, ref originalURL, ref me, ref timeShiftFileName);
if (resolveToIP == true)
if ( !result.StartsWith("[ERROR]") )
{
result += "|" + originalURL;
if (resolveToIP == true)
{
result += "|" + originalURL;
}
else
{
result += "|";
}
result += "|" + timeShiftFileName +
"|" + me.CardId.ToString();
}
else
{
result += "|";
}
result += "|" + timeShiftFileName +
"|" + me.CardId.ToString();

writer.write(result);
}
Expand Down
1 change: 1 addition & 0 deletions TVServerXBMC/ConnectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private void addHandlers()
handlers.Add(new GetUserName(this));
// Settings:
handlers.Add(new GetCardSettings(this));
handlers.Add(new GetSignalQuality(this));

//handlers.Add(new Test(this));

Expand Down
4 changes: 2 additions & 2 deletions TVServerXBMC/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.1.3.107")]
[assembly: AssemblyFileVersion("1.1.3.107")]
[assembly: AssemblyVersion("1.1.3.109")]
[assembly: AssemblyFileVersion("1.1.3.109")]
14 changes: 13 additions & 1 deletion TVServerXBMC/TV/ServerInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public TvResult StartTimeShifting(int idChannel, ref string rtspURL, ref string
}
catch { }

Console.WriteLine("Timeshift started for channel: '" + vcard.ChannelName + "' on device '" + vcard.Name + "'");
Console.WriteLine("Timeshift started for channel: '" + vcard.ChannelName + "' on device '" + vcard.Name + "' card id=" + vcard.Id);
Log.Debug("TVServerXBMC: Timeshift started for channel: '" + vcard.ChannelName + "' on device '" + vcard.Name + "'");
Console.WriteLine("TV Server returned '" + rtspURL + "' as timeshift URL and " + timeshiftfilename + " as timeshift file");
Log.Debug("TVServerXBMC: TV Server returned '" + rtspURL + "' as timeshift URL and " + timeshiftfilename + " as timeshift file");
Expand Down Expand Up @@ -204,6 +204,7 @@ public TvResult StartTimeShifting(int idChannel, ref string rtspURL, ref string
watch.Stop();
Console.WriteLine("StartTimeShifting took " + watch.ElapsedMilliseconds.ToString() + " ms");
Log.Debug("TVServerXBMC: StartTimeShifting took " + watch.ElapsedMilliseconds.ToString() + " ms");

return result;
}

Expand Down Expand Up @@ -1455,6 +1456,7 @@ public bool UpdateSchedule(int scheduleindex, int channelId, int active, String
updatedSchedule.PostRecordInterval = postRecordInterval;
}
updatedSchedule.Persist();
RemoteControl.Instance.OnNewSchedule();

return true;
}
Expand All @@ -1472,6 +1474,7 @@ public bool UpdateRecording(int recordingindex, String recordingName)

recording.Title = recordingName;
recording.Persist();

return true;
}
catch
Expand Down Expand Up @@ -1571,6 +1574,15 @@ public List<String> GetCardSettings(int cardID)
return cardSettingsList;
}

public int GetSignalQuality(int cardID)
{
return controller.SignalLevel(cardID);
}

public int GetSignalLevel(int cardID)
{
return controller.SignalLevel(cardID);
}
#endregion
}
}
2 changes: 1 addition & 1 deletion TVServerXBMC/TVServerConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static String playChannel(int chanId, bool resolveHostnames, ref string O

if (result != TvResult.Succeeded)
{
rtspURL = "[ERROR]: TVServer answer: " + result.ToString();
rtspURL = "[ERROR]: TVServer answer: " + result.ToString() + "|" + (int) result;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions TVServerXBMC/TVServerXBMC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Compile Include="Commands\CloseConnection.cs" />
<Compile Include="Commands\CommandHandler.cs" />
<Compile Include="Commands\AddSchedule.cs" />
<Compile Include="Commands\GetSignalQuality.cs" />
<Compile Include="Commands\GetCardSettings.cs" />
<Compile Include="Commands\GetDriveSpace.cs" />
<Compile Include="Commands\GetRecordingInfo.cs" />
Expand Down

0 comments on commit b3aaf74

Please sign in to comment.