小编sta*_*her的帖子

Youtube-dl在音频转换期间添加元数据

抱歉,如果这个问题被误导了。我正在使用youtube-dl将歌曲视频下载为mp3,然后再将其添加到iTunes。问题在于视频似乎不在那里包含元数据。我阅读了有关--add-metadata选项的信息,但据我了解,此选项仅用于在视频中已有ID的情况下添加ID?我知道歌手和歌手的名字,因此我想在可能的情况下直接添加它。东西效果--add-元数据的艺术家“的Pink Floyd”这是可能与当前的配置选项?我看到这个相关的问题,但它没有真正帮助https://github.com/rg3/youtube-dl/issues/ 1570 这是我当前的配置设置:

options = {
        'format':'bestaudio/best',
        'extractaudio':True,
        'audioformat':'mp3',
        'outtmpl':'%(id)s.%(ext)s',     #name the file the ID of the video
        'noplaylist':True,
        'nocheckcertificate':True,
        'proxy':"",
        'addmetadata':True,
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }]
    }
Run Code Online (Sandbox Code Playgroud)

python mp3 youtube-dl

8
推荐指数
2
解决办法
8211
查看次数

NLog:从nlog.config切换到编程配置

以前我的ASP .NET MVC5应用程序使用nlog.config文件时错误日志记录工作得很好.现在我想摆脱配置文件的方法; 我想以编程方式配置Nlog并删除对配置文件的需要.这些示例很好地向我展示了如何以编程方式设置它,但我对如何实际调用配置类并实际实现它感到困惑.继承人我所拥有的:

protected void Application_Error(object sender, EventArgs e)
    {
        Exception ex = Server.GetLastError();
        NALSPrincipal userInfo = (NALSPrincipal)Context.User;

        // Step 1. Create configuration object 
        var config = new LoggingConfiguration();

        // Step 2. Create targets and add them to the configuration 
        var fileTarget = new FileTarget();
        config.AddTarget("file", fileTarget);

        // Step 3. Set target properties 
        fileTarget.FileName = "C:/nlogFile.txt";
        fileTarget.Layout = "Exception Type: ${exception:format=Type}${newline}
                             Target Site:  ${event-context:TargetSite}${newline}
                             Message: ${message}";

        // Step 4. Define rules
        var rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget);
        config.LoggingRules.Add(rule2); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc logging nlog asp.net-mvc-5

7
推荐指数
1
解决办法
6939
查看次数

NLog通过一次调用记录LogEventInfo和Exception数据

我正在使用NLog来记录我的应用程序中捕获的错误.我已经弄清楚如何捕获异常并使用Logger.ErrorException()记录它们,并且我已经想出如何使用Logger.Log(LogEventInfo)记录上下文事件信息.但我希望能够一次性记录所有这些信息,而不是每个异常获得两个日志条目,每个日志条目只有一半的数据.下面是代码:

        Exception ex = Server.GetLastError();
        Logger logger = LogManager.GetCurrentClassLogger();
        LogEventInfo eventInfo = new LogEventInfo(LogLevel.Trace,  "Hello from RunJob", logger.Name);
        eventInfo.Properties["CustomerID"] = "someCustID";
        eventInfo.Properties["TargetSite"] "someTargetSite";
        logger.Log(eventInfo); //This results in a log entry which contains the values stored in 'CustomerID' and 'TargetSite', but not the details of the exception!
        logger.ErrorException(ex.Data.ToString(), ex); //this results in a log entry which contains the exception details, but not the event info stored in 'CustomerID' and 'TargetSite'!
Run Code Online (Sandbox Code Playgroud)

我想要的只是每个异常捕获的一个日志条目,并且日志条目需要包括CustomerID和TargetSite事件信息.

这是我的nlog.config布局,以防它有帮助:

          Current User ID: ${event-context:CUID}${newline}
          Target Site: ${event-context:TargetSite}${newline}
          Exception Type: …
Run Code Online (Sandbox Code Playgroud)

c# error-handling asp.net-mvc nlog visual-studio

5
推荐指数
1
解决办法
7177
查看次数

youtube-dl python 脚本后处理错误:无法识别 FFMPEG 编解码器

我的 python 脚本正在尝试使用 youtube-dl.py 下载 youtube 视频。除非需要后处理,否则工作正常。编码:

import youtube_dl

options = {
    'format':'bestaudio/best',
    'extractaudio':True,
    'audioformat':'mp3',
    'outtmpl':'%(id)s',     #name the file the ID of the video
    'noplaylist':True,
    'nocheckcertificate':True,
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }]
}

with youtube_dl.YoutubeDL(options) as ydl:
    ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
Run Code Online (Sandbox Code Playgroud)

以下是我收到的输出:在此处输入图片说明

如果我尝试将“preferredcodec”设置为“opus”或“best”,我会收到类似的错误。我不确定这是否相关,但我可以运行对应的命令行:

youtube-dl -o 'test2.%(ext)s' --extract-audio --audio-format mp3 --no-check-certificate https://www.youtube.com/watch?v=BaW_jenozKc
Run Code Online (Sandbox Code Playgroud)

我从互联网和其他问题中得到了一些线索,据我所知,这很可能是我的 ffmpeg 的问题,它不是 python 模块,对吗?这是我的 ffmpeg 版本和配置: 在此处输入图片说明

如果我的问题的答案是向我的 ffmpeg 添加一些配置设置,请解释我是如何做的。

python youtube ffmpeg youtube-dl

5
推荐指数
1
解决办法
5826
查看次数

在 C# 中解析 C 头文件

我正在使用 Visual Studio C#,我需要解析 C 头文件以仅提取有关其中包含的函数声明的信息。对于每个函数,我都需要名称、返回类型及其参数。如果可能,我希望参数按照它们在函数声明中出现的顺序排列。我在网上看到过关于使用 Visual Studios 标签或 Exhuberant Ctags 等的内容。但从我收集到的内容来看,这些并不是让我使用 C# 代码从我的 C# 程序执行解析的真正选项(我可能误会了?)。我还查看了相关问题的所有其他答案,但它们似乎并不真正适用于我的情况(我可能只是愚蠢)。如果我至少可以得到代表函数声明的所有代码行,我会有一个良好的开端,并且可以自己手动解析其余部分。

c# parsing

2
推荐指数
1
解决办法
2314
查看次数