Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monetization type filters #154

Merged
merged 3 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ run-update-films:
run-update-offers:
pdm run update-offers $(ARGS) | $(RUN_LOG_CMD)

run-update-services:
pdm run update-services $(ARGS) | $(RUN_LOG_CMD)

run-cleanup:
pdm run cleanup $(ARGS) | $(RUN_LOG_CMD)

run-all: run-update-directors run-update-films run-update-offers run-cleanup
run-all: run-update-directors run-update-films run-update-offers run-update-services run-cleanup

run-db-upgrade:
pdm run alembic upgrade head
Expand Down
44 changes: 44 additions & 0 deletions alembic/versions/8e251e9b7a42_add_monetization_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""add-monetization-type

Revision ID: 8e251e9b7a42
Revises: 853345b1c2f1
Create Date: 2024-11-30 12:50:24.880021

"""

from typing import Sequence, Union

# TODO: Fix type ignore by moving alembic/ directory?
from alembic import op # type: ignore[attr-defined]
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "8e251e9b7a42"
down_revision: Union[str, None] = "853345b1c2f1"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column(
"offers",
sa.Column(
"monetization_type",
sa.Enum(
"FREE",
"FLATRATE",
"RENT",
"BUY",
"CINEMA",
"ADS",
"FAST",
"DISC",
name="monetizationtype",
),
),
)


def downgrade() -> None:
op.drop_column("offers", "monetization_type")
14 changes: 7 additions & 7 deletions configs/default.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"Top Movies": {
"max_movies": 7,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.85",
"min_length": 60,
"exclude_genres": ["documentary", "animation"]
},
"International": {
"max_movies": 5,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.85",
"min_length": 60,
"exclude_genres": ["documentary", "animation"],
"exclude_countries": ["USA", "UK", "Canada", "Australia"]
},
"Horrors": {
"max_movies": 3,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.75",
"genre": "horror",
"min_length": 60,
"exclude_genres": ["documentary", "animation"]
},
"Classics": {
"max_movies": 3,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.90",
"min_year": 1900,
"max_year": 1970,
Expand All @@ -33,23 +33,23 @@
},
"Animation": {
"max_movies": 2,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.75",
"min_length": 60,
"genre": "animation",
"exclude_countries": ["Japan"]
},
"Anime": {
"max_movies": 2,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.75",
"min_length": 60,
"genre": "animation",
"country": "Japan"
},
"Documentaries": {
"max_movies": 3,
"services": ["STREAM"],
"services": ["FREE", "ADS", "FLATRATE", "RENT", "BUY"],
"min_rating": "3.75",
"min_length": 60,
"genre": "documentary"
Expand Down
1 change: 1 addition & 0 deletions js/docs/DirectorFilmsInnerOffersInner.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | |
**monetizationType** | **String** | |
**url** | **String** | |


22 changes: 18 additions & 4 deletions js/src/model/DirectorFilmsInnerOffersInner.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@ class DirectorFilmsInnerOffersInner {
* Constructs a new <code>DirectorFilmsInnerOffersInner</code>.
* @alias module:model/DirectorFilmsInnerOffersInner
* @param name {String}
* @param monetizationType {String}
* @param url {String}
*/
constructor(name, url) {
constructor(name, monetizationType, url) {

DirectorFilmsInnerOffersInner.initialize(this, name, url);
DirectorFilmsInnerOffersInner.initialize(this, name, monetizationType, url);
}

/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj, name, url) {
static initialize(obj, name, monetizationType, url) {
obj['name'] = name;
obj['monetization_type'] = monetizationType;
obj['url'] = url;
}

Expand All @@ -54,6 +56,9 @@ class DirectorFilmsInnerOffersInner {
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'String');
}
if (data.hasOwnProperty('monetization_type')) {
obj['monetization_type'] = ApiClient.convertToType(data['monetization_type'], 'String');
}
if (data.hasOwnProperty('url')) {
obj['url'] = ApiClient.convertToType(data['url'], 'String');
}
Expand All @@ -78,6 +83,10 @@ class DirectorFilmsInnerOffersInner {
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
}
// ensure the json data is a string
if (data['monetization_type'] && !(typeof data['monetization_type'] === 'string' || data['monetization_type'] instanceof String)) {
throw new Error("Expected the field `monetization_type` to be a primitive type in the JSON string but got " + data['monetization_type']);
}
// ensure the json data is a string
if (data['url'] && !(typeof data['url'] === 'string' || data['url'] instanceof String)) {
throw new Error("Expected the field `url` to be a primitive type in the JSON string but got " + data['url']);
}
Expand All @@ -88,13 +97,18 @@ class DirectorFilmsInnerOffersInner {

}

DirectorFilmsInnerOffersInner.RequiredProperties = ["name", "url"];
DirectorFilmsInnerOffersInner.RequiredProperties = ["name", "monetization_type", "url"];

/**
* @member {String} name
*/
DirectorFilmsInnerOffersInner.prototype['name'] = undefined;

/**
* @member {String} monetization_type
*/
DirectorFilmsInnerOffersInner.prototype['monetization_type'] = undefined;

/**
* @member {String} url
*/
Expand Down
6 changes: 6 additions & 0 deletions js/test/model/DirectorFilmsInnerOffersInner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
//expect(instance).to.be();
});

it('should have the property monetizationType (base name: "monetization_type")', function() {
// uncomment below and update the code to test the property monetizationType
//var instance = new LetsrolldApi.DirectorFilmsInnerOffersInner();
//expect(instance).to.be();
});

it('should have the property url (base name: "url")', function() {
// uncomment below and update the code to test the property url
//var instance = new LetsrolldApi.DirectorFilmsInnerOffersInner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ class ArrayOfDirectorsItemFilmsItemOffersItem:
"""
Attributes:
name (str):
monetization_type (str):
url (Union[None, str]):
"""

name: str
monetization_type: str
url: Union[None, str]
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
name = self.name

monetization_type = self.monetization_type

url: Union[None, str]
url = self.url

Expand All @@ -29,6 +33,7 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update(
{
"name": name,
"monetization_type": monetization_type,
"url": url,
}
)
Expand All @@ -40,6 +45,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
name = d.pop("name")

monetization_type = d.pop("monetization_type")

def _parse_url(data: object) -> Union[None, str]:
if data is None:
return data
Expand All @@ -49,6 +56,7 @@ def _parse_url(data: object) -> Union[None, str]:

array_of_directors_item_films_item_offers_item = cls(
name=name,
monetization_type=monetization_type,
url=url,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ class ArrayOfFilmsItemOffersItem:
"""
Attributes:
name (str):
monetization_type (str):
url (Union[None, str]):
"""

name: str
monetization_type: str
url: Union[None, str]
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
name = self.name

monetization_type = self.monetization_type

url: Union[None, str]
url = self.url

Expand All @@ -29,6 +33,7 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update(
{
"name": name,
"monetization_type": monetization_type,
"url": url,
}
)
Expand All @@ -40,6 +45,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
name = d.pop("name")

monetization_type = d.pop("monetization_type")

def _parse_url(data: object) -> Union[None, str]:
if data is None:
return data
Expand All @@ -49,6 +56,7 @@ def _parse_url(data: object) -> Union[None, str]:

array_of_films_item_offers_item = cls(
name=name,
monetization_type=monetization_type,
url=url,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ class ArrayOfReportsItemSectionsItemFilmsItemOffersItem:
"""
Attributes:
name (str):
monetization_type (str):
url (Union[None, str]):
"""

name: str
monetization_type: str
url: Union[None, str]
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
name = self.name

monetization_type = self.monetization_type

url: Union[None, str]
url = self.url

Expand All @@ -29,6 +33,7 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update(
{
"name": name,
"monetization_type": monetization_type,
"url": url,
}
)
Expand All @@ -40,6 +45,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
name = d.pop("name")

monetization_type = d.pop("monetization_type")

def _parse_url(data: object) -> Union[None, str]:
if data is None:
return data
Expand All @@ -49,6 +56,7 @@ def _parse_url(data: object) -> Union[None, str]:

array_of_reports_item_sections_item_films_item_offers_item = cls(
name=name,
monetization_type=monetization_type,
url=url,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ class DirectorFilmsItemOffersItem:
"""
Attributes:
name (str):
monetization_type (str):
url (Union[None, str]):
"""

name: str
monetization_type: str
url: Union[None, str]
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
name = self.name

monetization_type = self.monetization_type

url: Union[None, str]
url = self.url

Expand All @@ -29,6 +33,7 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update(
{
"name": name,
"monetization_type": monetization_type,
"url": url,
}
)
Expand All @@ -40,6 +45,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
name = d.pop("name")

monetization_type = d.pop("monetization_type")

def _parse_url(data: object) -> Union[None, str]:
if data is None:
return data
Expand All @@ -49,6 +56,7 @@ def _parse_url(data: object) -> Union[None, str]:

director_films_item_offers_item = cls(
name=name,
monetization_type=monetization_type,
url=url,
)

Expand Down
Loading
Loading