Skip to content

Commit

Permalink
Fixed some encoding errors. Implemented media/metadata/create.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeMayo committed Dec 21, 2017
1 parent 1738c38 commit fb5dee9
Show file tree
Hide file tree
Showing 42 changed files with 1,154 additions and 7,271 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
<Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.40326, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\src\LinqToTwitter\LinqToTwitter.AspNet\bin\Debug\LinqToTwitter.AspNet.dll</HintPath>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.16286, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.AspNet.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=957107be965c25d9, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\src\LinqToTwitter\LinqToTwitter.net\bin\Debug\LinqToTwitter.net.dll</HintPath>
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AI.Agent.Intercept, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.4.0\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

<!-- Fill in your consumer key and secret here to make the OAuth sample work. -->
<!-- Twitter sign-up: https://dev.twitter.com/ -->
<add key="consumerKey" value=""/>
<add key="consumerSecret" value=""/>
<add key="oauthToken" value=""/>
<add key="oauthTokenSecret" value=""/>
<add key="accessToken" value=""/>
<add key="accessTokenSecret" value=""/>
<add key="apiKey" value=""/>
<add key="consumerKey" value="" />
<add key="consumerSecret" value="" />
<add key="oauthToken" value="" />
<add key="oauthTokenSecret" value="" />
<add key="accessToken" value="" />
<add key="accessTokenSecret" value="" />
<add key="apiKey" value="" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<package id="Antlr" version="3.5.0.2" targetFramework="net461" />
<package id="bootstrap" version="3.3.7" targetFramework="net461" />
<package id="jQuery" version="3.2.1" targetFramework="net461" />
<package id="linqtotwitter" version="4.2.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.4.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.4.1" targetFramework="net461" />
Expand Down
11 changes: 1 addition & 10 deletions Samples/net46/CSharp/AspNetSamples/CoreDemo/CoreDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Providers.Core" Version="2.0.0" />
<PackageReference Include="linqtotwitter" Version="4.2.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.1" />
</ItemGroup>
Expand All @@ -14,13 +14,4 @@
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
</ItemGroup>

<ItemGroup>
<Reference Include="LinqToTwitter.AspNetCore">
<HintPath>..\..\..\..\..\src\LinqToTwitter\LinqToTwitter.AspNetCore\bin\Debug\netstandard1.6\LinqToTwitter.AspNetCore.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.Core">
<HintPath>..\..\..\..\..\src\LinqToTwitter\LinqToTwitter.AspNetCore\bin\Debug\netstandard1.6\LinqToTwitter.Core.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Samples/net46/CSharp/AspNetSamples/CoreDemo/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
},
"Twitter": {
"ConsumerKey": "",
"ConsumerSecret": ""
"ConsumerKey": "xhKOS1fJSIUSQostBYaR67US4",
"ConsumerSecret": "3tnImAh5UloHfaCjSNIfaJoXIbKJSxtYhNXEn0mTtGBHXYLxYG"
}
}
14 changes: 5 additions & 9 deletions Samples/net46/CSharp/AspNetSamples/MvcDemo/MvcDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.37398, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0-beta3\lib\net45\LinqToTwitter.AspNet.dll</HintPath>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.16286, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.AspNet.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=957107be965c25d9, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0-beta3\lib\net45\LinqToTwitter.net.dll</HintPath>
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
Expand Down Expand Up @@ -104,19 +104,15 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.PlatformServices, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-PlatformServices.2.3\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
Expand Down
4 changes: 2 additions & 2 deletions Samples/net46/CSharp/AspNetSamples/MvcDemo/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="jQuery" version="3.1.1" targetFramework="net452" />
<package id="jQuery.Validation" version="1.16.0" targetFramework="net452" />
<package id="linqtotwitter" version="4.2.0-beta3" targetFramework="net452" />
<package id="linqtotwitter" version="4.2.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net452" />
Expand Down Expand Up @@ -34,6 +34,6 @@
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net452" />
<package id="Rx-Linq" version="2.2.5" targetFramework="net452" />
<package id="Rx-Main" version="2.2.5" targetFramework="net452" />
<package id="Rx-PlatformServices" version="2.3" targetFramework="net452" />
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net452" />
<package id="WebGrease" version="1.6.0" targetFramework="net452" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
<Reference Include="AspNet.ScriptManager.jQuery, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\AspNet.ScriptManager.jQuery.3.1.1\lib\net45\AspNet.ScriptManager.jQuery.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.37398, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0-beta3\lib\net45\LinqToTwitter.AspNet.dll</HintPath>
<Reference Include="LinqToTwitter.AspNet, Version=3.2.0.16286, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.AspNet.dll</HintPath>
</Reference>
<Reference Include="LinqToTwitter.net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=957107be965c25d9, processorArchitecture=MSIL">
<HintPath>..\packages\linqtotwitter.4.2.0-beta3\lib\net45\LinqToTwitter.net.dll</HintPath>
<HintPath>..\packages\linqtotwitter.4.2.0\lib\net45\LinqToTwitter.net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
Expand Down Expand Up @@ -103,19 +103,15 @@
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.PlatformServices, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-PlatformServices.2.3\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<package id="bootstrap" version="3.3.7" targetFramework="net452" />
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="jQuery" version="3.1.1" targetFramework="net452" />
<package id="linqtotwitter" version="4.2.0-beta3" targetFramework="net452" />
<package id="linqtotwitter" version="4.2.0" targetFramework="net452" />
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" />
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
Expand Down Expand Up @@ -40,6 +40,6 @@
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net452" />
<package id="Rx-Linq" version="2.2.5" targetFramework="net452" />
<package id="Rx-Main" version="2.2.5" targetFramework="net452" />
<package id="Rx-PlatformServices" version="2.3" targetFramework="net452" />
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net452" />
<package id="WebGrease" version="1.6.0" targetFramework="net452" />
</packages>
25 changes: 13 additions & 12 deletions Samples/net46/CSharp/ConsoleSamples/ConsoleSamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,29 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.Core, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\System.Reactive.Core.3.1.1\lib\net45\System.Reactive.Core.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.Linq, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\System.Reactive.Linq.3.1.1\lib\net45\System.Reactive.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Reactive.PlatformServices, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\System.Reactive.PlatformServices.3.1.1\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\..\src\LinqToTwitter\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccountActivityDemos.cs" />
Expand Down
52 changes: 52 additions & 0 deletions Samples/net46/CSharp/ConsoleSamples/MediaDemos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ internal static async Task RunAsync(TwitterContext twitterCtx)
Console.WriteLine("\n\tUploading a video...\n");
await UploadVideoAsync(twitterCtx);
break;
case '1':
Console.WriteLine("\n\tCreating metadata...\n");
await CreateMetadataAsync(twitterCtx);
break;
case 'q':
case 'Q':
Console.WriteLine("\nReturning...\n");
Expand All @@ -43,6 +47,7 @@ static void ShowMenu()
Console.WriteLine("\nMedia Demos - Please select:\n");

Console.WriteLine("\t 0. Upload a Video");
Console.WriteLine("\t 1. Create Metadata");

Console.WriteLine();
Console.Write("\t Q. Return to Main menu");
Expand Down Expand Up @@ -104,5 +109,52 @@ static async Task UploadVideoAsync(TwitterContext twitterCtx)
Console.WriteLine($"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}");
}
}

static async Task CreateMetadataAsync(TwitterContext twitterCtx)
{
string status =
"Testing video upload tweet #Linq2Twitter £ " +
DateTime.Now.ToString(CultureInfo.InvariantCulture);

//Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterNormalTest.mp4"), "video/mp4", "tweet_video");
Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterMediumTest.mp4"), "video/mp4", "tweet_video");
//Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterErrorTest.mp4"), "video/mp4", "tweet_video");

Media mediaStatusResponse = null;
do
{
if (mediaStatusResponse != null)
{
int checkAfterSeconds = mediaStatusResponse?.ProcessingInfo?.CheckAfterSeconds ?? 0;
Console.WriteLine($"Twitter video testing in progress - waiting {checkAfterSeconds} seconds.");
await Task.Delay(checkAfterSeconds * 1000);
}

mediaStatusResponse =
await
(from stat in twitterCtx.Media
where stat.Type == MediaType.Status &&
stat.MediaID == media.MediaID
select stat)
.SingleOrDefaultAsync();
} while (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.InProgress);

if (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.Succeeded)
{
await twitterCtx.CreateMediaMetadataAsync(mediaStatusResponse.MediaID, "LINQ to Twitter Alt Text Test");

Status tweet = await twitterCtx.TweetAsync(status, new ulong[] { media.MediaID });

if (tweet != null)
Console.WriteLine($"Tweet sent: {tweet.Text}");
}
else
{
MediaError error = mediaStatusResponse?.ProcessingInfo?.Error;

if (error != null)
Console.WriteLine($"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}");
}
}
}
}
1 change: 1 addition & 0 deletions Samples/net46/CSharp/ConsoleSamples/SearchDemos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static void ShowMenu()
static async Task DoSearchAsync(TwitterContext twitterCtx)
{
string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo";
searchTerm = "кот (";

Search searchResponse =
await
Expand Down
Loading

0 comments on commit fb5dee9

Please sign in to comment.