Skip to content

Commit

Permalink
Added StartAsync to SocialMediaProviders - fixes FritzAndFriends#94
Browse files Browse the repository at this point in the history
Applying formatting changes through GitHub Actions

Merged

Fixed brackets

WIP

Applying formatting changes through GitHub Actions

WIP

Marked ProviderId as required in Message (FritzAndFriends#217)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Anchored overlay to the current logged in user (FritzAndFriends#219)

Updated docs, slight UI tweaks (FritzAndFriends#220)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Applying formatting changes through GitHub Actions

Removed the YouTubeScraper

Fixed repeated emotes in TwitchChat

Now retrieving YouTube events for the current user

Now fetching channel information

Applying formatting changes through GitHub Actions

Fixed missing implementation

Applying formatting changes through GitHub Actions
  • Loading branch information
csharpfritz committed Sep 26, 2023
1 parent 2818d5b commit 86921bc
Show file tree
Hide file tree
Showing 48 changed files with 1,516 additions and 1,125 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TagzApp
A new website that searches social media for hashtags.
A new website tool that searches social media for hashtags, and tracks chat interaction on several live streaming services

![Sample Screenshot from August 7, 2023](doc/img/Screenshot-2023-08-07.png)
![Sample Screenshot from August 7, 2023](doc/img/Screenshot-2023-09-26.png)

### Overlay display

Expand All @@ -12,6 +12,20 @@ When some content is selected on the waterfall display, we have an overlay avail

## Current Status

We are working towards a website minimum-viable-product that searches Mastodon and shows matching messages on screen. At this time we're setting up for one service and one in memory queue to use as a pub sub mechanism with signalr to push new messages on screen.
We have completed an initial minimum viable product and stress tested the application by capturing tweets during the NFL kickoff grame on September 7, 2023 between Kansas City and Detroit using the hashtag #DETvsKC

Data is stored in a combination of Sqlite and Postgres databases. We have configured an extensive provider model so that we can add new social media services in the future.

Live chat integration (TwitchChat, YouTubeChat, etc) captures all messages that are delivered over that service.

We also have a simple moderation capability.

### Currently Supported Services

- [Blazot](https://www.blazot.com/)
- Mastodon
- Twitter / X
- TwitchChat
- YouTube (search for videos that have a given hashtag in the description)


### Overlay
Binary file added doc/img/Screenshot-2023-09-26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/TagzApp.Common/ISocialMediaProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ public interface ISocialMediaProvider
/// <returns></returns>
Task<IEnumerable<Content>> GetContentForHashtag(Hashtag tag, DateTimeOffset since);

/// <summary>
/// Start the provider
/// </summary>
/// <returns></returns>
Task StartAsync();

}
2 changes: 2 additions & 0 deletions src/TagzApp.Common/InMemoryContentMessaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public void StartProviders(IEnumerable<ISocialMediaProvider> providers, Cancella

var lastQueryTime = DateTimeOffset.UtcNow.AddHours(-1);

await provider.StartAsync();

while (!cancellationToken.IsCancellationRequested)
{
if (!_Actions.Any())
Expand Down
8 changes: 1 addition & 7 deletions src/TagzApp.Common/Models/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ public class Content
/// </summary>
public required string Provider { get; set; }

/// <summary>
/// Id provided by the provider for this content
/// </summary>
// TODO: CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public string ProviderId { get; set; }
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public required string ProviderId { get; set; }

public string HashtagSought { get; set; } = string.Empty;

Expand Down
5 changes: 5 additions & 0 deletions src/TagzApp.Providers.Blazot/BlazotProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,9 @@ public async Task<IEnumerable<Content>> GetContentForHashtag(Hashtag tag, DateTi

return _ContentConverter.ConvertToContent(transmissions, tag);
}

public Task StartAsync()
{
return Task.CompletedTask;
}
}
191 changes: 98 additions & 93 deletions src/TagzApp.Providers.Mastodon/MastodonProvider.cs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/TagzApp.Providers.TwitchChat/ChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,12 @@ internal static List<Emote> IdentifyEmotes(string msg)
foreach (var emote in emotesRaw)
{
var parts = emote.Split(":");
var positions = parts[1].Split("-");
emotes.Add(new Emote(int.Parse(positions[0]), int.Parse(positions[1]) - int.Parse(positions[0]) + 1, $"https://static-cdn.jtvnw.net/emoticons/v2/{parts[0]}/static/light/2.0"));
var entries = parts[1].Split(",");
foreach (var entry in entries)
{
var positions = entry.Split("-");
emotes.Add(new Emote(int.Parse(positions[0]), int.Parse(positions[1]) - int.Parse(positions[0]) + 1, $"https://static-cdn.jtvnw.net/emoticons/v2/{parts[0]}/static/light/2.0"));
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/TagzApp.Providers.TwitchChat/TwitchChatProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public TwitchChatProvider(IOptions<TwitchChatConfiguration> settings, ILogger<Tw
_Settings = settings.Value;
_Logger = logger;
_ProfileRepository = new TwitchProfileRepository(_Settings.ClientId, _Settings.ClientSecret, clientFactory.CreateClient("TwitchProfile"));
ListenForMessages();
}

internal TwitchChatProvider(IOptions<TwitchChatConfiguration> settings, ILogger<TwitchChatProvider> logger, IChatClient chatClient)
Expand Down Expand Up @@ -122,4 +121,10 @@ public void Dispose()
Dispose(disposing: true);
GC.SuppressFinalize(this);
}

public Task StartAsync()
{
ListenForMessages();
return Task.CompletedTask;
}
}
Loading

0 comments on commit 86921bc

Please sign in to comment.