Reply to thread

If you are bored :D i have some special wishes for some changes i've made to MPExtended for Emby

that i'd like to see in MP2Extended also:

Services/MPExtended.Services.TVAccessService/TVAccessService.cs

[CODE=C#]public WebBoolResult UnCancelSchedule(int programId)

{

    try

    {

        Log.Debug("Uncancelling schedule for programId {0}", programId);

        var program = Program.Retrieve(programId);

        foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsSerieIsCanceled(program.StartTime, program.IdChannel)))

        {

            schedule.UnCancelSerie(program.StartTime, program.IdChannel);

            schedule.Persist();

        }


        return true;

    }

    catch (Exception ex)

    {

        Log.Warn(String.Format("Failed to uncancel schedule for programId {0}", programId), ex);

        return false;

    }

}[/CODE]


Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs

[CODE=C#][OperationContract]

[WebGet(ResponseFormat = WebMessageFormat.Json)]

WebBoolResult UnCancelSchedule(int programId);[/CODE]


Services/MPExtended.Services.StreamingService/StreamingService.cs

[CODE=C#]public Stream DoStream(WebMediaType type, int? provider, string itemId, string identifier, string clientDescription, string profileName, long startPosition, int? idleTimeout)

{

    if (!IsClientAuthorized())

    {

        Log.Warn("Host {0} isn't authorized to call DoStream", WCFUtil.GetClientIPAddress());

        WCFUtil.SetResponseCode(HttpStatusCode.Unauthorized);

        return Stream.Null;

    }


    // calculate timeout, which is by default 5 minutes for direct streaming and 5 seconds for transcoded streams

    var profile = Configuration.StreamingProfiles.Transcoders.FirstOrDefault(x => x.Name == profileName);

    if(profile == null)

    {

        Log.Warn("Called DoStream with non-existing profile {0}", profileName);

        return Stream.Null;

    }

    int timeout = profile.Transcoder == typeof(Transcoders.Direct).FullName ? 5 * 60 : 5;

    if (idleTimeout.HasValue)

        timeout = idleTimeout.Value;


    // This only works with profiles that actually return something in the RetrieveStream method (i.e. no RTSP or CustomTranscoderData)

    StreamLog.Debug(identifier, "DoStream: using timeout={0}", timeout);


    if (!InitStream(type, provider, itemId, null, clientDescription, identifier, timeout))

    {

        StreamLog.Info(identifier, "DoStream: InitStream() failed");

        FinishStream(identifier);

        return Stream.Null;

    }


    if (String.IsNullOrEmpty(StartStream(identifier, profileName, startPosition)))

    {

        StreamLog.Info(identifier, "DoStream: StartStream failed");

        FinishStream(identifier);

        return Stream.Null;

    }


    StreamLog.Info(identifier, "DoStream: succeeded, returning stream");

    return RetrieveStream(identifier);

}[/CODE]




Top Bottom