-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #64: Added support to export liked comments/lists from trakt.tv.
- Loading branch information
1 parent
53ca0df
commit 7fb7c6a
Showing
10 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace TraktRater.TraktAPI.DataStructures | ||
{ | ||
[DataContract] | ||
public class TraktLike : IEquatable<TraktLike> | ||
{ | ||
[DataMember(Name = "liked_at")] | ||
public string LikedAt { get; set; } | ||
|
||
[DataMember(Name = "type")] | ||
public string Type { get; set; } | ||
|
||
[DataMember(Name = "list")] | ||
public TraktListDetail List { get; set; } | ||
|
||
[DataMember(Name = "comment")] | ||
public TraktComment Comment { get; set; } | ||
|
||
#region IEquatable | ||
public bool Equals(TraktLike other) | ||
{ | ||
if (other == null || (other.Comment == null && other.Type == "comment") || (other.List == null && other.Type == "list")) | ||
return false; | ||
|
||
if (this.Type == "list") | ||
{ | ||
if (this.List.Ids == null || other.List.Ids == null) | ||
return false; | ||
|
||
return (this.Type == other.Type && this.List.Ids.Trakt == other.List.Ids.Trakt); | ||
} | ||
else | ||
{ | ||
return (this.Type == other.Type && this.Comment.Id == other.Comment.Id); | ||
} | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
if (this.Type == "list") | ||
{ | ||
return (this.List.Ids.Trakt.ToString() + "_" + this.Type).GetHashCode(); | ||
} | ||
else | ||
{ | ||
return (this.Comment.Id.ToString() + "_" + this.Type).GetHashCode(); | ||
} | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace TraktRater.TraktAPI.DataStructures | ||
{ | ||
public class TraktLikes : TraktPagination | ||
{ | ||
public IEnumerable<TraktLike> Likes { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters